auth0 / auth0-angular

Auth0 SDK for Angular Single Page Applications
MIT License
176 stars 58 forks source link

Getting intermittent error when logging in #624

Closed djwatson82 closed 3 months ago

djwatson82 commented 3 months ago

Checklist

Description

I am following the suggested login flow documented, but I am intermittently getting an error after login (with redirect) that makes it appear that the user did not log in. Subscribing to authService.error$ returns the following error only when this issue occurs:

Error: Compilation failed: Cannot overwrite `user` model once compiled.
    at te.<anonymous> (auth0-spa-js.production.esm.js:1:32881)
    at Generator.next (<anonymous>)
    at chunk-DHZM6WDG.js?v=b79609c9:77:61
    at new ZoneAwarePromise (polyfills.js:2118:23)
    at __async (chunk-DHZM6WDG.js?v=b79609c9:61:10)
    at te.handleRedirectCallback (auth0-spa-js.production.esm.js:1:32342)
    at auth0-auth0-angular.mjs:491:41
    at Observable2._subscribe (defer.js:5:19)
    at Observable2._trySubscribe (Observable.js:38:25)
    at Observable.js:32:31

This error is also reproducible with the angular sample app, and the angular-spa-js sample app.

Reproduction

  1. On button click, call loginWithRedirect. Make sure to be subscribing to error$.
  2. Login as usual through auth0 UI.
  3. Intermittently, when redirected back to out application, the above error is throw and the user is not authenticated (isAuthenticated$ will return false).

Additional context

auth0-angular version

2.2.3

Angular version

18.0.5

Which browsers have you tested in?

Chrome, Edge, Safari, Firefox

djwatson82 commented 3 months ago

This issue was related to an error in our Actions flow for post-login, but was surfacing as an error in the app.