Replace Editor OAuth Authentication Challenge Handler

462
1
01-11-2024 05:55 AM
anzago
by
New Contributor

Hi,

I'm having some trouble accessing 3 private ArcGIS Enterprise services in the same Unity scene (Image layer basemap, Elevation source and 3D Object scene layer).

I configured an OAuth 2.0 authentication configuration that is linked to these 3 services. The authentication in itself is working great, but the built-in challenge handler for the editor is behaving weirdly : 

  • It seems that because 3 services are authenticated at the same time, the SDK triggers 3 auth challenges at the same time, but since only one C# Task can be listening to localhost, the others fail and the associated layers are just not loaded (sometimes if I'm fast enough at validating in the browser, no conflict happen and I can load the 3 layers).
    This process feels weird to me, shouldn't we use only one authorization code to access n services with the same auth configuration ?
  • When entering play mode, the scene is reloaded and new challenges are triggered, but they can happen while challenges from play mode are triggered too, conflicting with each other (this problem should not happen when running a build outside of the editor though).

This is why I want to write my own challenge handler and implement code caching by replacing the ArcGISEditorOAuthAuthenticationChallengeHandler that is used for editor mode, but since it is attached in a static constructor with [InitializeOnLoad] attribute, I found no way to replace it (it is attached in in Esri.ArcGISMapsSDK.Editor.Utils.Environment).

I tried to attach it in the same way the SDK does it but sadly my [InitializeOnLoad] code is always executed before the SDK one, so the default handler is always the one attached at the end

Is there a way to put a custom AuthenticationChallengeHandler for Editor mode ?

Thankful for any help !

0 Kudos
1 Reply
MichaelBranscomb
Esri Frequent Contributor

Hi,

Unfortunately, it is not currently possible to implement a custom challenge handler that will replace ArcGISEditorOAuthAuthenticationChallengeHandler..cs and respond to challenges at editor-time. We are planning additional authentication work for a future release which will aim to resolve the issues you’re seeing in the editor, but unfortunately it’s not currently possible to share the timeframe for this work. Regarding challenges at run-time that may overlap, it should be possible to avoid this by implementing a custom challenge handler - which may be the approach you've already tried? If so, can you share the code for your custom run-time challenge handler?

 

Thanks   

0 Kudos