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
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.