Select to view content in your preferred language

ESRI JS API: IdentityManager: Store the oauth state in local-storage ?

5092
11
03-04-2020 03:48 PM
by Anonymous User
Not applicable

Hi, I've asked a similar question before, and also resolved it myself here:
ESRI JS API: IdentityManager: how to use localStorage 

This was for the scenario, where I've used the popup: true for the OAuth2.0 authentication.

However, I'm now in the scenario where I have to use redirect to the agol's/portal's oAuth page insteas of a popup, so I have to use the popup: false.

This seem to work fine, but the problem is that user has to approve the access each time he opens the app, because the oath state is stored in session-storage in esriJSAPIOauth property, instead of local-storage. I guess this all happens as there is no presence of any 'Keep Me Signed In' or similar checkbox for the enterprise login oAuth page.

Does anyone know how can I force the IdentityManager to store the redirected oauth state into the session-storage ?

Thank you.

ESRI JS API: 4.14
AGOL/PORTAL SECURITY: Enterprise logins

0 Kudos
11 Replies
LucVanDijk
Occasional Contributor

Hi @fdeters ,
This solution seems like exactly what I need. Could you please explain where I should implement this code? I want to apply this solution to my web app which is built using ArcGIS Experience Builder Developer Edition.
Cheers,
Luc

0 Kudos
fdeters
Regular Contributor

Hi @LucVanDijk! Unfortunately, I am not familiar with Experience Builder Developer Edition. My recommendation is to search the Experience Builder Developer Edition documentation (the documentation page for jimu/core/State might be a good place to start).

Ultimately, you want to make sure that:

  1. Whenever the user's login status changes, the IdentityManager is saved in LocalStorage.
  2. The app looks for IdentityManager data stored in LocalStorage before redirecting the user to the login flow.

Because of my lack of Experience Builder Developer Edition knowledge, I'm not sure either of those things are possible. Good luck! I'd be interested to know if you find a solution.