How to retrieve refresh token using auth0/auth0-react

  • Which SDK this is regarding: auth0-react
  • SDK Version: 1.7.0
  • Platform Version: Node v14.17.5

I have followed the Auth0 Ionic & Capacitor (React) SDK Quickstarts: Login guide to add Auth0 login to a Capacitor app, an iOS app to be specific.

The guide explains how to login and all that works well. But we would like to store the refresh token you get, store it in the secure app storage and then use that (if not expired) next time the use opens the app. The question is: how do I get the refresh token? I can’t see any methods for getting that token. The library uses auth0/auth0-spa-js under the hood, and I don’t see any way to get the refresh token from that library either. It looks like it’s configured to work automatically. But in this case we would like to store it to use it later on. Is that possible?

Thanks!

We found a solution ourselves. You can pass useRefreshTokens: true to the Auth0 provider and use a specific cache. I found the documentation here: Auth0ProviderOptions | @auth0/auth0-react. Then the package solves the rest for you automatically.