Select to view content in your preferred language

Problems utilising app authentication in Kotlin

152
1
a month ago
johnms93
Emerging Contributor

I've been following instructions here: https://developers.arcgis.com/documentation/security-and-authentication/app-authentication/

I have a web server which has a client ID and secret using OAuth to generate a token. This token gets downloaded to an Android client which I intend to use for ArcGIS mapping. I will handle downloading fresh tokens when need be.

This exact scenario is supposedly supported according to the documentation above.

However, once I download this token to my client, there is no suitable ArcGISCredentials I can use to store it in the ArcGISCredentialStore.

I assumed PregeneratedTokenCredential would be the answer, but that requires you to use a /generateToken endpoint which is not OAuth. That endpoint uses a username and password. Therefore the token I use here is invalid.

The OAuthTokenCredentials either initiate a login flow, or use a client secret on the client. These are not suitable.

Why can't I just use the OAuth token I have downloaded to the client, which the documentation has suggested I can do?

Is there something I'm missing?

0 Kudos
1 Reply
GuntherHeppner
Esri Contributor
You should be able to use PregeneratedTokenCredential for your use case. Did you try that out or did you take your assumption that it doesn't work from some documentation? If you tried it out, could you share more details about usage and error details.
 
 
0 Kudos