Hi guys,
I created an angualr app from scratch and followed https://auth0.com/docs/quickstart/spa/angular/interactive
to setup the app step by step. Basically my code is as simple as.
In HomeComponent:
<div *ngIf="(auth.isAuthenticated$ | async) === false">
<app-login-button></app-login-button>
<app-user-profile *ngIf="auth.user$ | async as user"></app-user-profile>
</div>
<div *ngIf="auth.isAuthenticated$ | async">
<span>Welcome <app-user-profile *ngIf="auth.user$ | async as user"></app-user-profile><app-logout-button></app-logout-button></span>
</div>
And my app.module.ts imports part.
imports: [
BrowserModule,
AppRoutingModule,
AuthModule.forRoot({
domain: 'dev-u1q32atd78t8nep6.us.auth0.com',
clientId: 'CiXG0SZK9LxDLdGICp2FsgXZTOEas6GN',
authorizationParams: {
redirect_uri: window.location.origin
}
}),
LoginButtonComponent,
LogoutButtonComponent,
],
And the logout button and login button are exactly same as in the tutorial.
But not sure why the auth.isAuthenticated is always returning false.
I also downloaded the sample app and setup pointing to the same application in Auth0 registration. This is running perfectly. I really got puzzled.
Could someone give a hand? Any advice would be highly appreciated!