From 3d228037f3f88a7e4cc78f306f994446dea37077 Mon Sep 17 00:00:00 2001 From: Keith LaForce Date: Thu, 16 Sep 2021 20:21:02 -0400 Subject: [PATCH] fix(web): fixing bug around automatic authentication for auth0 --- packages/web/src/api/hasteClient.ts | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/packages/web/src/api/hasteClient.ts b/packages/web/src/api/hasteClient.ts index e00502d..1d08523 100644 --- a/packages/web/src/api/hasteClient.ts +++ b/packages/web/src/api/hasteClient.ts @@ -35,7 +35,6 @@ export class HasteClient { } public async handleRedirect() { - const isAuthenticated = await this.isAuthenticated(); const query = window.location.search; if (query.includes('code=') && query.includes('state=')) { @@ -51,13 +50,15 @@ export class HasteClient { throw new Error(`An error occurred during authentication process`); } } else { - if (isAuthenticated) { + try { const token = await this.getTokenSilently(); - return { - token: token, - isAuthenticated: true, - } as HasteAuthentication; - } + if (token) { + return { + token: token, + isAuthenticated: true, + } as HasteAuthentication; + } + } catch (err) {} } return {