Please include the following information in your post:
- Which SDK this is regarding: Angular SDK
- SDK Version: @auth0/auth0-angular": “^1.3.2”
- Platform Version: Node v14.16.0
When i try to subscribe and get the user profile, its making a bunch of the authentication calls. I just want to make one and based on the app_metadata returned, redirect my user to the appropriate route. Below is the code that I have. Any suggestions:
this.authService.user$.subscribe((data) => {
if(data){
this.http.get(`https://${domain}/api/v2/users/${data.sub}`).subscribe(
user => {
this.profile = user
if(this.profile.app_metadata){
this.companyId = this.profile.app_metadata.companyId
}
}
)
}
});
if(isNumber(this.companyId)){
this.router.navigate(["my-client", this.companyId])
}else {
this.router.navigate(["client"])
}