AnsweredAssumed Answered

Tokens returned from Portal oauth2 are invalid for accessing hosted features through the REST API

Question asked by james.gough_SussexCounty on Aug 22, 2018

I am attempting to authenticate a script to add features to a Portal hosted feature service through the REST API.

 

Using oauth2 and the client credentials flow I am able to obtain a token from `</portal/sharing/rest/oauth2/token>` by supplying the client id and client secret of a registered app, however when I attempt to use this token I get the following response:

 

`'{"error":{"code":498,"message":"Invalid Token","details":[]}}'`

 

I have used this method to authenticate with ArcGIS Online in the past but I can not get it to work with Portal.

 

I am able to obtain a valid token using the `</sharing/rest/generateToken>` resource, but this requires me to use my username and password. I would prefer to use oauth2 and provide the App's client id/secret instead of having to provide user credentials.

 

How can I obtain a token from Portal through oauth2 that is valid for accessing hosted feature services

Outcomes