Missing Refresh Token Error When Using getAccessTokenSilently With Params

Ready to post? :mag: First, try searching for your answer.

This code works:
const options = {
detailedResponse: true
};
return this.auth.getAccessTokenSilently(options);

This code gives me Missing Refresh Token error:
const options = {
detailedResponse: true,
authorizationParams: {scope:‘additional_scope’},
};
return this.auth.getAccessTokenSilently(options);

additional_scope is defined for the API.

Any ideas if it is possible to add additional scopes on the fly? I’m trying to get an access token with very specific scope before calling a resource endpoint. Each endpoint will require its own scope.

Hi @jquerijero,

I recommend checking out our Error: Missing Refresh Token knowledge solution on this error for more details.

Now, you should be able to pass the scope in the request outlined in the GetTokenSilentlyOptions | @auth0/auth0-react documentation.

If you need to add scopes dynamically on login, you could use a post-login action script and call the api.accessToken.addScope(scope) method.

Thanks,
Rueben

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.