Getting 'Invalid state' with sign-up, login afterwards works

My workflow:

  • passwordless
  • magic links, ie registration proceed in another window
  • Angular SPA with passwordless Auth0-hosted page
  • @auth0/auth0-angular”: “1.9.0”,

When user is registered, he is redirected on UI but no authentication happened, showed error in console

app.component.ts:61 
        
       Auth: Error: Invalid state
    at e.<anonymous> (auth0-spa-js.production.esm.js:15:83846)
    at auth0-spa-js.production.esm.js:15:2236
    at Object.next (auth0-spa-js.production.esm.js:15:1552)
    at auth0-spa-js.production.esm.js:15:1278
    at new ZoneAwarePromise (zone.js:1427:1)
    at o (auth0-spa-js.production.esm.js:15:1023)
    at e.handleRedirectCallback (auth0-spa-js.production.esm.js:15:83283)
    at auth0-auth0-angular.js:484:21
    at Observable._subscribe (defer.js:5:18)
    at Observable._trySubscribe (Observable.js:37:1)

Never mind, I should set useCookiesForTransactions as parameters for AuthConfig

 AuthModule.forRoot({
      domain: 'YOUR_AUTH0_DOMAIN',
      clientId: 'YOUR_AUTH0_CLIENT_ID',
      useCookiesForTransactions: true
    }),
1 Like

Thanks for sharing it with the rest of community!