Auth0 Home Blog Docs

Refresh token within Ionic App

auth0js
renewauth
ionic2

#1

Is it possible to refresh a token within a Ionic/Cordova app? I’m looking at the renewAuth function in auth0.js, but not sure what the config object values should be. Specifically the redirectUri value.


#2

The renewAuth function in Auth0.js is meant for web applications as it performs its work by leveraging an hidden iframe.

If you’re developing a mobile application and you already have a refresh token then the last step, the refresh request, can be made with any library that is able to perform an HTTP request. You can check the reference documentation on using a refresh token which includes examples in various languages/platforms. Although we have a library for Cordova applications auth0-cordova, at this time, it does not seem to include a utility method to refresh tokens. The library does handle the PKCE exchange which is the most complex part of the process so it’s still beneficial to use that library and then just do an HTTP request to the token endpoint.


#3

Ok thanks, nothing in the sdk to help so I’ll call the auth0 api directly. I don’t intend to use PKCE since it is really awkward UX and maintenance - and I don’t intend to use social media login.

Thanks for the help!


#4

Ok thanks, nothing in the sdk to help so I’ll call the auth0 api directly. I don’t intend to use PKCE since it is really awkward UX and maintenance - and I don’t intend to use social media login.

Thanks for the help!


#5