TypeError: a is not a constructor

I’s getting following error, even without any code change (parseHash method) .

vue.esm.js:1897 TypeError: a is not a constructor
at n.validateToken (index.js:253)
at n.validateAuthenticationResponse (index.js:196)
at n.parseHash (index.js:160)
at t.value (authservice.js:45)
at s.created (footer.vue:46)
at st (vue.esm.js:1863)
at ke (vue.esm.js:4222)
at s.t._init (vue.esm.js:5011)
at new s (vue.esm.js:5157)
at Xt (vue.esm.js:3292)

Following is the method for authentication, we are using for last 2 years, and now its throwing error.

handleAuthentication() {
// console.log(“check”);
this.auth0 = new auth0.WebAuth({
domain: AUTH_CONFIG.domain,
clientID: AUTH_CONFIG.clientId,
redirectUri: AUTH_CONFIG.callbackUrl,
audience: https://${AUTH_CONFIG.domain}/userinfo,
responseType: ‘token id_token’,
scope: ‘openid’
})

    **this.auth0.parseHash((err, authResult, profile) => {**
        if (authResult && authResult.accessToken && authResult.idToken) {
            
            this.setSession(authResult)
        } else if (err) {
            console.log(err)
        }
    })
}

Please advise.

Hi @droneapp, welcome to the Auth0 Community!

Can you let me know what version of auth0-js is in your package.json file and which is actually installed (usually you can see it in package-lock.json)?

Cheers,
Sam Julien

Hi Sam,
Following are the versions of auth0-js.
package.json : 8.8.0
package-lock.json: 8.11.2

Please advise.


regards,
Drone App Team

Since v8 of auth0-js is deprecated, you might try migrating to v9 and seeing if that fixes the issue (the current version as of this post is 9.11.2).

Here’s some information on v9, as well as a migration guide from v8.

If that doesn’t work, we can try to dig deeper into this issue.