How to share OAuth Access Token server-side & client-side?

1416
0
09-28-2017 02:15 PM
GavinHarriss
New Contributor

I have an ASP.NET MVC web application that is authenticating users server-side against ArcGIS Portal successfully using Owin.Security.Providers.ArcGISPortal.

I would like to use the granted authorization client-side in the browser without requiring the user to login a second time via ArcGIS's JavaScript API v3.21. Does anyone have any pointers regarding how to obtain a relevant token and pass this through client-side to access portal secured web maps, etc.?

There is a context.AccessToken that I can obtain via ArcGISPortalAuthenticationHandler and make available as a claim, but when I try to use this manually via a url like so

https://myportal.domain.com/arcgis/sharing/rest/content/items/1c3fbebbd4994f94b7e4d91449c2954c/data?...{access_token}

I get an "Invalid token" response back.

Any ideas? If you know of a working example for ArcGIS Online then this could also help me as ArcGIS Online and ArcGIS Portal seem to be identical in their mechanics.

0 Kudos
0 Replies