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

Add refreshIfAvailable flag to login() #94

Merged
merged 2 commits into from Feb 11, 2021

Conversation

graknol
Copy link
Contributor

@graknol graknol commented Feb 10, 2021

There's a chance that the consuming API, client and Azure AD might be out of sync with regards to time.
This creates a temporal dependency when you only depend on the client's current time.

For this reason, robust clients should instead listen for 401 HTTP response codes to then attempt to refresh the access tokens.
This PR enables you to force the use of the refresh token if it is available.

If a refresh token is not available (i.e. due to missing scope), it'll fall back to check the expiry using the client's local time. If that's still valid it'll return the existing access token.

If any of these fail, it'll still show the full web gui flow as a last resort.

@graknol graknol changed the title Add refreshIfAvailable flag to login(). Add refreshIfAvailable flag to login() Feb 10, 2021
@sladomic sladomic merged commit 5bd0ded into Earlybyte:master Feb 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants