Skip to content

Commit

Permalink
fix(web): fixing bug around automatic authentication for auth0
Browse files Browse the repository at this point in the history
  • Loading branch information
rallieon committed Sep 17, 2021
1 parent be314fe commit 3d22803
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions packages/web/src/api/hasteClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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=')) {
Expand All @@ -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 {
Expand Down

0 comments on commit 3d22803

Please sign in to comment.