Auth0 Home Blog Docs

Auth0 JS - signupAndAuthorize does not log in?


#1

I’m using Auth0JS in my Angular 5 application.

When I sign up a user using signupAndAuthorize, the result is good; an access token.
However, when I then call checkSession immediately, this results in an error “login_required”.

This seems conflicting; why does the signupAndAuthorize return an access token, but the checkSession requires logging in again?


#2

:wave: @roland are you still experiencing this issue? The login_required usually happens when you are signing in using a social provider with Auth0 dev keys and call checkSession.

If this is not the case for you, can you please share your code to be able reproduce the issue.


#3

@kim.noel I’m signing people of with a local account, so nothing to do with
This is the code:

signupEmailPassword(email: string, password: string): Observable<string> {
      this.auth0.signupAndAuthorize(<any> {
        email: email,
        password: password,
        redirectUri: `http://site.local:4200/auth-callback.html`,
        connection: 'Username-Password-Authentication'
      }, (err, authResult) => {
        if (authResult && !err) {
          this.setAuthenticated(authResult);
        } else {
          this._loggingService.log({
            message: err.code + err.policy,
            severity: LogSeverity.Error
          });
        }
      });
    }));
  }
/// and then:

this.auth0.checkSession({}, (err, authResult) => {
        if (err) {
// err is now login_required
});