auth0 / auth0-angular

Auth0 SDK for Angular Single Page Applications
MIT License
179 stars 61 forks source link

Add a package or support for the AnalogJS Meta Framework #612

Open SemmelJochen opened 5 months ago

SemmelJochen commented 5 months ago

Checklist

Describe the problem you'd like to have solved

I am trying to setup a new application using AnalogJs. I just tried adding the auth0/angular package and setup as advised in the auth0 docs, but the Login does not work properly. When calling loginWithRedirect() I am able to log in in the Logs I can see a Login Event but no more. In my Application I am not able to use the isAuthenticated and user$ because they are always "false" and "null".

Screenshot 2024-06-08 at 20 15 50

In my network tab I can see the following session being set:

Screenshot 2024-06-08 at 20 18 50

I also tried the SPA and Regular Web App setup.

Describe the ideal solution

I want to be able to use the auth0 package within my AnalogJs setup

Alternatives and current workarounds

No response

Additional context

No response

frederikprijck commented 5 months ago

Can you share minimal reproduction so we can look into what's going on?

SemmelJochen commented 5 months ago

@frederikprijck u can use my test for this. https://github.com/SemmelJochen/nx-coffeelogger-test

frederikprijck commented 5 months ago

@SemmelJochen can you please explain where to find the relevant code and how to reproduce? Thanks.

SemmelJochen commented 5 months ago

@frederikprijck sorry, about that. To reproduce. Checkout the repo, npm i (or bun), run "nx serve coffeelogger". Then you login with your Github Account (app must run on localhost:4200 but its default anyway). Then you will be forwarded to the app again and you can see in the logs, that no user will be available. Relevant code:

Tell me if im missing something :)

frederikprijck commented 5 months ago

Can you confirm that after logging in, the URL still contains code and state query parameters?

If so, can you try and inject AuthService in AppComponent (no need to use it, just inject it) and see if it behaves different?

Additionally, our SDK is build on top of the Angular Router, see https://github.com/auth0/auth0-angular/blob/main/projects/auth0-angular/src/lib/abstract-navigator.ts. So it may be needed to provide your own AbstractNavigator as well.