Token based authentication from xamarin

10-11-2021 01:12 AM
New Contributor II

To implement token based authentication, there are sample to use the Authentication Manger and the user credentials used to login and generate the token. Once the token generated it automatically allow the server to enabled to access and those operations handled by ArcGIS NuGet. 

            TokenCredential userCredentials = await AuthenticationManager.Current.GenerateCredentialAsync

My question is, since the token can be created for some amount of time, is there any other way to reuse the generated token instead of creating every time with the user credentials & AUTH Manager. 

0 Kudos
2 Replies
MVP Regular Contributor

I assume you meant ArcGIS online not ArcGIS nuget.

If you use the challenge handler pattern, it will only request a new token when it is required.  Its a WPF sample but same in Xamarin


Esri Frequent Contributor

You could also take a look at the CredentialPersistence API:

For more info see this Dev Summit session and jump to 15:00 minutes:

0 Kudos