diff --git a/packages/auth/src/OAuth/OAuth.ts b/packages/auth/src/OAuth/OAuth.ts index 96159e11998..7b61bd0417e 100644 --- a/packages/auth/src/OAuth/OAuth.ts +++ b/packages/auth/src/OAuth/OAuth.ts @@ -183,8 +183,9 @@ export default class OAuth { } private async _handleImplicitFlow(currentUrl: string) { - const { id_token, access_token } = parse(currentUrl) - .hash.substr(1) // Remove # from returned code + // hash is `null` if `#` doesn't exist on URL + const { id_token, access_token } = (parse(currentUrl).hash || '#') + .substr(1) // Remove # from returned code .split('&') .map(pairings => pairings.split('=')) .reduce((accum, [k, v]) => ({ ...accum, [k]: v }), {