-
Notifications
You must be signed in to change notification settings - Fork 69
Description
Checklist
- The issue can be reproduced in the auth0-angular sample app (or N/A).
- I have looked into the Readme, Examples, and FAQ and have not found a suitable solution or answer.
- I have looked into the API documentation and have not found a suitable solution or answer.
- I have searched the issues and have not found a suitable solution or answer.
- I have searched the Auth0 Community forums and have not found a suitable solution or answer.
- I agree to the terms within the Auth0 Code of Conduct.
Description
Hi there,
It looks like using the AuthHttpInterceptor along with detailedResponse: true on the httpInterceptor results in the interceptor attempting to send the full detailedResponse object as the Authorization header, rather than the access token in the response.
I've managed to recreate this with the sample app by filling in the relevant details, and adjusting the config in environment.ts to:
export const environment = {
production: false,
auth: {
domain,
clientId,
authorizationParams: {
...(audience && audience !== '{yourApiIdentifier}' ? { audience } : null),
redirect_uri: window.location.origin,
},
errorPath,
},
httpInterceptor: {
allowedList: [
{
uri: `${apiUri}/*`,
tokenOptions: {
detailedResponse: true
}
}
],
},
};Trying to ping the external API results in a header of Authorization: Bearer [object Object].
It looks like the problem is in the AuthState class in setAccessToken
| public setAccessToken(accessToken: string): void { |
The input to this could be the access token or the detailed response object from the Auth0Client.getTokenSilently. I'm not sure if you'd expect getTokenSilently to return the full detailed response or just the access token.
Reproduction
Step 1: Clone the sample repo.
Step 2: Add the relevant Auth0 config.
Step 3: Add detailedResponse to the tokenOptions on the httpInterceptor config.
Step 4: Load the app and ping the external API - you'll get a 401 since we aren't attaching the access token.
Additional context
No response
auth0-angular version
2.2.3
Angular version
20
Which browsers have you tested in?
Chrome