Hey, @dan-auth0 thanks for your reply. I’m pretty much doing exactly like Auth0 Angular SDK Quickstarts: Login the angular quickstart, that’s pretty much the architecture my app is following, the only difference is I was passing the custom scopes in the loginWithRedirect() method and it was causing a delay I don’t know why. And also I included these scopes in httpInterceptor tokenOptions.
But I think I found a solution yesterday:
I don’t know why but if I set my scopes in the authentication module initialization and don’t pass it in the loginWithRedirect() the delay does not occur and my isAuthenticated$ returns true straightway after the login.
Solution:
app.module.ts
AuthModule.forRoot({
...environment.auth,
httpInterceptor: {
...environment.httpInterceptor,
},
})
environment.ts
Before I was not setting my scopes in the auth section.
export const environment = {
production: false,
apiUrl: apiUrl,
appUrl: appUrl,
auth: {
domain: “mydomain-dev.au.auth0.com”,
clientId: “myclientId”,
audience: “myaudience”,
redirectUri: ${appUrl}
,
scope: ‘read:sponsors create:sponsor read:programs delete:sponsor-program-enrolment’
},
httpInterceptor: {
allowedList: [
{
uri: ${apiUrl}/*
,
tokenOptions: {
// The attached token should target this audience
audience: ‘myaudience’,
// The attached token should have these scopes
scope: ‘read:sponsors create:sponsor read:programs delete:sponsor-program-enrolment’
}
}
]
}
};
app.component.ts
I’m not setting the scopes in the loginWithRedirect() method anymore.
loginWithRedirect() {
this.auth.loginWithRedirect();
}
This solution worked for me and no more delay with isAuthenticated$.