Skip to content

Commit

Permalink
fix(web): adding logs for debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
foundrium committed Jan 31, 2022
1 parent ced86c6 commit 71e9c51
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 3 deletions.
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 18 additions & 0 deletions packages/web/src/api/hasteClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,15 +79,29 @@ export class HasteClient {
await this.logout();
} else {
const query = window.location.search;
// eslint-disable-next-line no-console
console.log(`query = ${query}`);
const shouldParseResult = query.includes('code=') && query.includes('state=');
// eslint-disable-next-line no-console
console.log(`shouldParseResult = ${JSON.stringify(shouldParseResult)}`);

if (shouldParseResult) {
// eslint-disable-next-line no-console
console.log(`in the should parse result`);
await this.auth0Client.handleRedirectCallback();
// eslint-disable-next-line no-console
console.log(`past the handleRedirectCallback in the should parse result`);
}

// eslint-disable-next-line no-console
console.log(`getting the token silently`);
const accessToken = await this.auth0Client.getTokenSilently();
// eslint-disable-next-line no-console
console.log(`accessToken = ${JSON.stringify(accessToken)}`);
const idTokenClaims = await this.auth0Client.getIdTokenClaims();
const idToken = idTokenClaims.__raw;
// eslint-disable-next-line no-console
console.log(`idToken = ${JSON.stringify(idToken)}`);

const decoded = jwtDecode<JwtPayload>(idToken);
if (accessToken) {
Expand All @@ -102,6 +116,8 @@ export class HasteClient {
}
// eslint-disable-next-line @typescript-eslint/no-explicit-any
} catch (err: any) {
// eslint-disable-next-line no-console
console.error(err);
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
if (err.error === 'consent_required') {
const hint = btoa(`${v4()};;;;;${window.location.href};;;;;${'game'}`);
Expand All @@ -119,6 +135,8 @@ export class HasteClient {
}
}

// eslint-disable-next-line no-console
console.log(`not logged in`);
return {
token: '',
isAuthenticated: false,
Expand Down

0 comments on commit 71e9c51

Please sign in to comment.