auth0.js: Angular 2 Auth0.WebAuth is not a constructor

Auth0.js Version: http://cdn.auth0.com/js/auth0/8.3.0/auth0.min.js

HI, I’m try use de Auth0 with Angular 2, and i got some issues.

I try this:

` declare var Auth0: any;

@Injectable() export class AuthService { auth0 = new Auth0.WebAuth({ domain: ‘mydomain.auth0.com’, clientID: ‘MYID’, responseType: ‘token’, redirectUri: ‘http://localhost:4200/’ })

googleLogin() {
    this.auth0.authorize({
        connection: 'google-oauth2'
    })

}

}

`

With this setup above, i received this error:

EXCEPTION: Uncaught (in promise): TypeError: Auth0.WebAuth is not a constructor TypeError: Auth0.WebAuth is not a constructor

What is wrong in my setup ?

I follow this guide : https://auth0.com/docs/libraries/auth0js

Thanks

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 21 (10 by maintainers)

Most upvoted comments

You’re using auth0.webAuth. It’s auth0.WebAuth.

Thanks! I just notified our docs team and they’ll submit a fix shortly. Sorry for the confusion 🎉

Thank you!!! have a great help i strugged for almost 2 hrs. Saved my time and life!!!