I’m developing an Angular 8 SPA and have successfully integrated Auth0 authentication.The profile information for each user displays just as the tutorial shows. How do I access the email property?
{
"nickname": "user,
"name": "user@email.com",
"picture": "https://s.gravatar.com/user_image.png",
"updated_at": "2020-01-15T17:39:10.467Z",
"email": "user@email.com",
"email_verified": true,
"sub": "auth0|000000000000000000000000"
}
In app.module.ts, I tried subscribing with the following:
currentUser: string;
this.auth.userProfile$.subscribe(userProfile => {this.currentUser = userProfile});
console.log(this.currentUser);
However, in the console I just get: null
. As far as I can tell, auth.service.ts
provides the necessary observable:
private userProfileSubject$ = new BehaviorSubject<any>(null);
userProfile$ = this.userProfileSubject$.asObservable();
Any direction is appreciated.