Auth0.js: parseHash in version 9.7.3 TypeError : Cannot create property '__enableIdPInitiatedLogin'...

Created on 29 Aug 2018  路  4Comments  路  Source: auth0/auth0.js

I just upgraded to auth0-js version 9.7.3 and the login flow seems to be breaking in the auth0.parseHash in the callback URL, I am getting the following error:

TypeError: Cannot create property '__enableIdPInitiatedLogin' on string '#access_token={token string}&token_type=Bearer&state={state string}'

The same workflow throws no error in version 9.6.1. Is there anything I am missing?

Most helpful comment

It was working by accident then (also, the string is being ignored in your case), considering that we expect the first parameter to either be an object or a callback function.

All of our docs mention that:

In your case, the simples fix is to just remove the first parameter and keep only the callback. window.location.hash is already used when there's no options object.

All 4 comments

do you have a code snippet on how are you calling parseHash?

This is it: (haven't updated anything from v9.6.1 code):

auth0.parseHash(window.location.hash, (err, result) => {

It was working by accident then (also, the string is being ignored in your case), considering that we expect the first parameter to either be an object or a callback function.

All of our docs mention that:

In your case, the simples fix is to just remove the first parameter and keep only the callback. window.location.hash is already used when there's no options object.

Brilliant, got it now.
auth.auth0.parseHash((err, result) => ... works like a charm.

Thanks for the quick response!

Was this page helpful?
0 / 5 - 0 ratings