I am trying to use the new credential system included with Esri's Unity SDK version 2.0. I already have a system for obtaining the user's credentials so creating a handler the way the samples indicate won't work or it adds multiple logins required for my app to function (poor user experience). That was when i came across PregeneratedTokenCredential:
The problem is that this doesn't appear to be included in the GameEngine version and unless I'm missing something, I don't have a way of just using my own system and just provide the token to Esri's sdk to use as well.
With the new authentication implementation you shouldn't need to login multiple times (unless you are loading contents from multiple portals). By design, you will also be prompted to login (again) when you open the editor and/or press play. If you are having issues with multiple logins other than these cases, please let us know.
If you want to keep using pregenerated tokens, you should be able to use them as the api key. If you want to load different layers with different tokens/keys, you would have to add those layers through api.
Another option that you have is to implement your own login handler for the play mode and standalone builds based on our sample code in `SampleOAuthUserLoginPromptHandler` and insert the pregenerated code as the server response in there. To register the custom handler with the authentication manager, write your own script or modify the `SampleAuthenticationHandlerInitializer` component.
I did a test and was able to use a pregenerated access code (generated through the oauth workflow) for loading arcgis online/organization content. But I wasn't able to make it work for enterprise (portal) content. Is that the type of data you are using?
Could you also describe how you are generating the access code?