Hi @dan-auth0
I am facing the exact same issue with the Angular SDK. Has there been any solution or a bug fix?
I am exactly following this guide, but I’m unfortunately always getting false
for isAuthenticated$
even after logging in successfully. Here are snippets of my code:
app.component.html
:
<div id="app" class="d-flex flex-column h-100">
<div *ngIf="authService.isLoading$ | async; else loaded">
Loading...
</div>
<ng-template #loaded>
<router-outlet></router-outlet>
</ng-template>
</div>
app.component.ts
:
import { Component, OnInit } from '@angular/core';
import { AuthService } from '@auth0/auth0-angular';
@Component({
selector: 'body',
templateUrl: './app.component.html',
})
export class AppComponent implements OnInit {
constructor(public authService: AuthService) { }
ngOnInit() {
}
}
auth-button.component.ts
:
import { Component, OnInit } from '@angular/core';
import { AuthService } from '@auth0/auth0-angular';
@Component({
selector: 'app-auth-button',
templateUrl: './auth-button.component.html',
styles: [],
})
export class AuthButtonComponent implements OnInit {
constructor(public authService: AuthService) { }
ngOnInit(): void { }
}
auth-button.component.html
:
<app-login-button *ngIf="(authService.isAuthenticated$ | async) === false">
</app-login-button>
<app-logout-button *ngIf="authService.isAuthenticated$ | async">
</app-logout-button>
Am I missing anything?