How to get the refresh_token with getAcessTokenSilently method from the Auth0 React SDK

Ready to post? :mag: First, try searching for your answer.
I need to access to the refresh_token so I tried calling the getAccessTokenSilently method like this:

    getAccessTokenSilently({
      authorizationParams: {
        scope: 'openid offline_access',
        grant_type: 'refresh_token',
      },
      cacheMode: 'off',
      detailedResponse: true,
    })

I can see in the networks tab that refresh_token is returned in the payload, but for some reason, getAccessTokenSilently returns everything except refresh_token. Why?

Hi @cinnabams3782,

Welcome to the Auth0 Community and sorry for the late reply.

You do not need to specify the grant_type: 'refresh_token' in order to use refresh tokens in the Auth-React SDK. You have correctly requested the offline_access scope, and you also need to allow offline access from this settings page and set the useRefreshTokens: true from the Auth0 Provider, since the SDK will generate the Refresh Tokens automatically. I would recommend checking the getAccessTokenSilently documentation from the Auth0-React SDK.

I hope this helps your case, but others as well.
Best regards,
Remus