OAuth2.0 redirect question

397
0
02-22-2019 01:58 AM
by Anonymous User
Not applicable

Hi, 

I'm doing a POC of the React application that is supposed to retrieve the user credentials from the arcgis.com and/or our internal portal. I've setup the router with some protected router, but I think I need an advice on what is the best approach to achieve the following:

1) app has 3 routes, /home - public route, /protected - protected route, /signin - public route with the signin components.

2) if user clicks the /protected route, I want to redirect to /signing (done)

3) on the /signin page, if user clicks 'Sign In' and signs in using the oauth provider and is successfully authenticated, then redirect him to /protected

4) if user is not authenticated and clicks the /signin page, and the is successfully authenticated, then redirect him to /home

My current solution is that I've setup the redirect on the application settings in the portal (http://localhost:3000), and before the authentication, I store the last path (referrer path) into localStorage and then pull it up. But I'd rather not do that.

How is this normally achieved? Can I provide the OAuthInfo some extra request params that it would parse back so I can use it in my application?

Also, another question is, how can I skip the step of displaying esriOAuthSignInDialog (after setting the popup to true in the OAuthInfo) and having to click 'ok' in order to proceed to OAuth signing new window popup??

Thank you

Tags (2)
0 Kudos
0 Replies