ReactNative - getCredentials returns undefined when a token is expired

Hi there,

I’m building a React Native app and I wanted to refresh expired access tokens using refresh tokens. I’ve configured everything in the Auth0 dashboard and I get a refresh token after authorization. The issue is when an access token expires and I call getCredentials method it returns undefined, but in fact the token is refreshed. To get a token I need to call the getCredentials method again. Not sure if that’s a desired behaviour. For now I just call it twice and it works, but it doesn’t look good. Does anyone else experience the same issue? Not sure if that’s related to React Native library: react-native-auth0 - npm or Auth0 in general. Couldn’t find anything helpful in the internet so far.

Hey @jakub.saleniuk welcome to the community!

Just to be clear, on the first call the refresh token is rotated (new refresh token) but there is no access token returned? On the 2nd call you do indeed get a new access token back as expected. FWIW it shouldn’t require 2 calls to getCredentials assuming a valid refresh token is available.

1 Like

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