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: Refresh access_token if expired #24

Merged
merged 9 commits into from Nov 5, 2020

fix race condition

  • Loading branch information
fcjr committed Nov 5, 2020
commit 815336345df8b314e9fb00be794db4705490a236
@@ -12,11 +12,12 @@ class AccessToken {
}

static async get() {
if (AccessToken.TOKEN) {
return AccessToken.TOKEN
const token = AccessToken.TOKEN;
if (token) {
return token;
}
await AccessToken.refresh();
return AccessToken.TOKEN
return AccessToken.TOKEN;
This conversation was marked as resolved by fcjr

This comment has been minimized.

@sammacbeth

sammacbeth Nov 5, 2020
Contributor

I'm not sure this will return the new token after a refresh. AccessToken.refresh will resolve after the fetch to the refresh token endpoint has completed, but AccessToken.TOKEN is updated after the cookie updated event.

}

static destroy() {
ProTip! Use n and p to navigate between commits in a pull request.