Direct username password authentication

There are cases where it is not possible to use OAuth 2.0 processes to obtain an ArcGIS Identity; this is most common when developing command line applications and scripting with ArcGIS REST JS and the ArcGIS API for Python or when using the ArcGIS REST APIs.

Using the generateToken REST API endpoint, you can get an ArcGIS Identity by sending a username and password directly.

Get an ArcGIS identity with a username and password

  1. Make a POST request to generateToken with the username, password and referer.
  2. The response will contain the ArcGIS identity in the access_token property of the response.
RequestResponse
      
1
2
3
4
5
6
curl https://www.arcgis.com/sharing/rest/generateToken \
 -X POST \
 -d 'f=pjson' \
 -d 'username=USERNAME' \
 -d 'password=PASSWORD' \
 -d 'referer=https://YOUR-APP.com'
     
1
2
3
4
5
{
  "token": "iX_oSlAphdxzi...",
  "expires": 1609488000000,
  "ssl": true
}
cURLArcGIS REST JSArcGIS API for Python
      
1
2
3
4
5
6
curl https://www.arcgis.com/sharing/rest/generateToken \
 -X POST \
 -d 'f=pjson' \
 -d 'username=USERNAME' \
 -d 'password=PASSWORD' \
 -d 'referer=https://YOUR-APP.com'

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.