Hi
Using the Auth0 Angular SDK and the configuring the Interceptor, I’m trying to pass in the cacheMode
parameter as part of the tokenOptions object as follows:
…
allowedList: [
{
uri: ‘https://api.x.api.com/api/api/api*’,
tokenOptions: {
authorizationParams: {
audience: ‘https://api.api.api’,
},
cacheMode: ‘off’,
},
},
]
…
But I get the following error at compile time:
Types of property ‘allowedList’ are incompatible.
Type '({ uri: string; tokenOptions: { authorizationParams: { audience: string; }; cacheMode: string; }; } | { uri: string; tokenOptions: { authorizationParams: { audience: string; }; cacheMode?: undefined; }; })[]' is not assignable to type 'ApiRouteDefinition[]'. Type '{ uri: string; tokenOptions: { authorizationParams: { audience: string; }; cacheMode: string; }; } | { uri: string; tokenOptions: { authorizationParams: { audience: string; }; cacheMode?: undefined; }; }' is not assignable to type 'ApiRouteDefinition'. Type '{ uri: string; tokenOptions: { authorizationParams: { audience: string; }; cacheMode: string; }; }' is not assignable to type 'ApiRouteDefinition'. Type '{ uri: string; tokenOptions: { authorizationParams: { audience: string; }; cacheMode: string; }; }' is not assignable to type 'HttpInterceptorRouteConfig'. The types of 'tokenOptions.cacheMode' are incompatible between these types. Type 'string' is not assignable to type '"off" | "on" | "cache-only"'.
The weird thing is, when I set the same parameter when calling getAccessTokenSilently directly I don’t get the same error:
this.auth
.getAccessTokenSilently({
authorizationParams: {
audience: ‘https://api.api.api’,
},
cacheMode: ‘off’,
})
Both objects, tokenOptions
in the interceptor and options
of the getAccessTokenSilently method, are the same type GetTokenSilentlyOptions
.
Any ideas?
Thanks in advance!