qri-io / frontend

frontend application for our qri.cloud site
GNU General Public License v3.0
3 stars 2 forks source link

[auth] Add a "remember me" checkbox to the login modal #644

Open chriswhong opened 2 years ago

chriswhong commented 2 years ago

The app will randomly log the user out. Tokens are not refreshing as they should. Investigate and ensure that the user can stay logged in for a reasonable time.

Arqu commented 2 years ago

Hey, I came this from a completely different angle. There's probably a few things at play, I solved the backend technical issue. https://github.com/qri-io/cloud/pull/633

The thing was that the lower level lib for it changed the error formatting and on some update we classified expired access tokens as a failure case. This meant you had to do a call to refresh (any api call would trigger it) in the last 5 minutes (ie the window when frontend triggers a refresh) and before it's expired so it doesn't fail. That's fixed now and it works as long as the accessToken is valid (even if expired) and the refresh token is still valid (which holds for 30 days).

On that note I wanted to suggest a small improvement, we should add a "remember me" checkmark on the login modal and if that is checked persist the refresh token, otherwise skip holding onto the refresh token.