Hello, I know this topics has been asked many times already but I did not find a solution.
I followed all steps from Auth0 turials to add Auth0 authentication on an Angular App, but after many hours, I can’t do a request to my API. It always send my a 401 error.
I’m on a development environment. I develop with Angular 13 framework and @auth0/auth0-angular 2.0.0
I set up a SPA on auth0 dashboard, and also an API.
Here’s the code I use on app.module.ts
AuthModule.forRoot({
domain: 'xxxx.auth0.com',
clientId: 'xxxxxx',
authorizationParams: {
redirect_uri: 'http://localhost:4200/dashboard',
// Request this audience at user authentication time
audience: 'http://localhost:4200/api',
},
httpInterceptor: {
allowedList: ['http://localhost:4200/api/someRequest'],
},
}),
When I access to my Angular App, I see the /auth/token request and it return a 200 code. In the response, I can see access_token, expires_in, id_token, scope and token_type.
But when I request my API, I don’t see the Authorization header attached to the request.
I don’t know where these tokens are normally stored (localStorage, sessionStorage, …)
I saw on similar topics, it might have a limitation on dev envs. How about this ? Is it supposed to work in dev ?
Thanks for your replies