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

Update State when error occurs while getting token #124

Merged
merged 3 commits into from
Mar 11, 2021

Conversation

frederikprijck
Copy link
Member

In the situation where getting an access token fails because the refresh token is expired and/or the session with Auth0 is also expired, the SDK throws a login required message but the state still reflects as if the user is authenticated.

This PR ensures that on every error, the Angular SDK retrieves the state (isAuthenticated, user and idTokenClaims) from the SPA JS SDK to guarantee the observables (isAuthenticated$, user$, idTokenClaims$) reflect the correct state.

You can test this in our playground as follows:

  • Ensure both refresh tokens and auth0 login session expires after 3 minutes
  • Login
  • Wait 3 minutes
  • Try to get a new token

Before this PR, the UI would still look as if the user is authenticated because the isAuthenticated$ observable still shows true.
After this PR the UI will look as if the user is not authenticated.

@frederikprijck frederikprijck requested a review from a team as a code owner February 22, 2021 11:35
@frederikprijck frederikprijck added the review:tiny Tiny review label Feb 22, 2021
@frederikprijck frederikprijck added the CH: Changed PR is changing something label Feb 22, 2021
@frederikprijck frederikprijck added this to the vNext milestone Feb 22, 2021
@frederikprijck frederikprijck merged commit 7edc150 into master Mar 11, 2021
@frederikprijck frederikprijck deleted the fix/update-state branch March 11, 2021 09:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CH: Changed PR is changing something review:tiny Tiny review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants