Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: User is cleared when access token expires even if it can be refreshed #154

Open
albertmoravec opened this issue Dec 20, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@albertmoravec
Copy link

albertmoravec commented Dec 20, 2024

Description

In certain cases, for example when application is in background the access token can expire and upon waking up the "expired" event is thrown. Expired event handler in turn calls forgetUser() even though the user has valid refresh token and the access token can be refreshed just fine.

Steps To Reproduce

Reproduction rate is not necessarily 100% due to circumstances I'm not too sure of.

  1. Authenticate successfully using any method
  2. Send the application to background
  3. Wait for access token to expire
  4. Open the application again - both expiring and expired events might get triggered at the same time
  5. User might be logged out as forgetUser() is called unconditionally

Expected Behavior

User is not logged out and access token is refreshed using existing valid refresh token.

Also there should be no need for any kind of timer, access token can be refreshed on-demand.

Event Tracing

Here's a sequence of events that we recorded when this error happened (newest to oldest):

Event Timestamp Note
ApplicationOpened 2024-12-20T16:44:11.256
OIDCRefreshFailed(CurrentUserNull) 2024-12-20T16:44:11.021 Refresh triggered from application code
OIDCUserEvent(null) 2024-12-20T16:44:11.009
OIDCEvent(Prelogout) 2024-12-20T16:44:11.007
OIDCEvent(TokenExpired) 2024-12-20T16:44:10.988
OIDCEvent(TokenExpiring) 2024-12-20T16:44:10.986
ApplicationBackgrounded 2024-12-20T16:36:35.291
@albertmoravec albertmoravec added the bug Something isn't working label Dec 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant