Select to view content in your preferred language

Trying to use ClientId and Secret to supersede user Auth to access Enterprise Portal feature layer

587
1
06-29-2022 07:14 AM
JLT
by
New Contributor II

Would really appreciate some help on this. I am trying to load a feature layer from our enterprise portal onto a map. I have been using the code samples that have been useful to an extent but the documentation around authorizing access to enterprise resources is a little scarce. Created an application in our portal which has its application ID and application secret and we are able to request an access token for this application with the following request:

POST /portal/sharing/rest/oauth2/token?client_id=[APPLICATION ID]&client_secret=[APPLICATION SECRET]&grant_type=client_credentials HTTP/1.1

Host: test.cloud.esriuk.com

However I can’t seem to find how we would authenticate a request using the javascript API using the app ID and app secret or even a generated token. The closest relevant information I can find is this section:

https://developers.arcgis.com/javascript/latest/arcgis-organization-portals/#connect-to-arcgis-enter...

Where it only refers to ‘an appropriate credential’ but contains no further information. There are no properties on the Portal object that relate to how you would authenticate to the enterprise portal. When we tried using this object this it redirects to ask for a username and password but because we use SSO we don’t have these stored on the ArcGIS side. We preferably don’t want to use an authorization code flow where the user logs in as themselves due to the complications we have come across and the client credential flow meets our needs.

Many thanks

1 Reply
AnonymousUser23
New Contributor III

@JLT , Did you ever figure this out? Thank you

0 Kudos