I have based on your examples created an Angular 11 SPA (running locally on port 4200) which communicates with a FastAPI based backend (running locally on localhost port 8080). I am using the package ‘fastapi-auth0’. Now although authentication works, my custom scope is not send with the token. The content of the token is ‘‘openid profile email’’.
Because on the Angular site my httpInterceptor is defined as:
AuthModule.forRoot({
domain: '<my domain>',
clientId: '<my client id>'',
// Request this audience at user authentication time
audience: 'https://<my API audience>',
// Request this scope at user authentication time
scope: 'read:measurements',
// Specify configuration for the interceptor
httpInterceptor: {
allowedList: [
{
// Match any request that starts with the uri defined below (note the asterisk)
uri: 'http://127.0.0.1:8080/*',
tokenOptions: {
// The attached token should target this audience
audience: '<my API audience>',
// The attached token should have these scopes
scope: 'read:measurements'
}
}
]
}
})
I would have expected the scope to contain ‘read:measurements’ too.
I have defined this in the ‘Permissions’ tab, by the way and enabled ‘RBAC’ and ‘Add Permissions in the Access Token’.