Auth0 Home Blog Docs

Xamarin - Using Refresh Token

Hello Auth0 Support Team (and Community!)

I have implemented Auth0 Authentication for a Xamarin Forms App using the example provided here: (https://auth0.com/docs/quickstart/native/xamarin/01-login).

Is there a refresh token example? And/Or, is there a suggested best-practice for Xamarin Forms app to utilize a refresh token when the access token expires OR, when the user closes/returns to the mobile app so that they do not need to login again?

Any help by anyone would be greatly appreciated.

Hey, did you try using “offline_access” scope in these two lines?

Hello @zulfiqar,

Thank you for the reply!

I ended up using:
_auth0Client = new Auth0Client(new Auth0ClientOptions
{
Domain = AuthenticationConfig.Domain,
ClientId = AuthenticationConfig.ClientId,
Scope = "openid offline_access"
});

This returns a refresh token, which I then re-use when needed by:
var refreshTokenResult = await _auth0Client.RefreshTokenAsync("…");

It seems to do the trick, I hope this is the proper way to apply this. Open to any suggestions.

Thanks

1 Like

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