How to use authentication

ArcGIS uses token-based authentication. All service requests made to must include an for authorization.

The general steps to implement authentication in your application are:

1. Create developer credentials

The first step in authentication is to create a set of . Developer credentials contain the properties and values required to get an , and allow you to configure the of the token to define the services and items it can access.

requires a set of .

ArcGIS Location PlatformArcGIS OnlineArcGIS Enterprise

The steps to create API key credentials with an are:

  1. Sign in to your .

  2. Click Content > My content > New item and select Developer credentials.

  3. In the Credential types menu, select API key credentials.

  4. Set the credential to determine the operations your will be authorized to perform.

  5. Set the credential item access privileges to determine the your will be authorized to access.

  6. Review your selections and, when you are ready, click Generate token. Save the as you will not be able to view it again.

The steps to create API key credentials with an are:

  1. Sign in to your .

  2. Click Content > My content > New item and select Developer credentials.

  3. In the Credential types menu, select API key credentials. If your account does not have the Generate API keys , this menu will not appear.

  4. Set the credential to determine the operations your will be authorized to perform.

  5. Set the credential item access privileges to determine the your will be authorized to access.

  6. Review your selections and, when you are ready, click Generate token. Save the as you will not be able to view it again.

The steps to create API key credentials with an are:

is not supported in ArcGIS Enterprise versions prior to 11.4.

  1. Sign in to your .

  2. Click Content > My content > New item and select Developer credentials.

  3. In the Credential types menu, select API key credentials. If your account does not have the Generate API keys , this menu will not appear.

  4. Set the credential to determine the operations your will be authorized to perform.

  5. Set the credential item access privileges to determine the your will be authorized to access.

  6. Review your selections and, when you are ready, click Generate token. Save the as you will not be able to view it again.

2. Get an access token

The next step is to get an by implementing a type of authentication. The implementation details depend on the type of authentication you choose:

API key authentication flow

The API key authentication workflow


3. Make a request

Once you have an , you can use it in your application to make requests to .

Mapping APIs

Display a basemap

If you use with an , the API key value is typically set once when the application is initialized and is applied every time a service request is made.

The examples below show how to use an API key to access the .

ArcGIS Maps SDK for JavaScriptArcGIS Maps SDK for JavaScriptArcGIS Maps SDK for .NETArcGIS Maps SDK for KotlinArcGIS Maps SDK for SwiftArcGIS Maps SDK for JavaArcGIS Maps SDK for QtArcGIS API for PythonEsri LeafletMapLibre GL JSOpenLayers
Expand
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
      esriConfig.apiKey= "YOUR_ACCESS_TOKEN";
      const map = new Map({
        basemap: "arcgis/topographic" // Basemap layer
      });

      const view = new MapView({
        map: map,
        center: [-118.805, 34.027],
        zoom: 13, // scale: 72223.819286
        container: "viewDiv",
        constraints: {
          snapToZoom: false
        }
      });

ArcGIS REST APIs

Access tokens returned from all three types of authentication can be used in REST API requests. To make a direct request to ArcGIS resources, you can use an HTTP request and include the access token as the token parameter. The format to access most REST API endpoints is as follows:

1
https://<RESOURCE_URL>?token=<YOUR_ACCESS_TOKEN>

Geocode an address

This example shows how to authenticate a request to the .

cURLcURLHTTP
1
2
3
4
curl https://geocode-api.arcgis.com/arcgis/rest/services/World/GeocodeServer/findAddressCandidates \
-d "f=pjson" \
-d "address=1600 Pennsylvania Ave NW, DC" \
-d "token=<YOUR_ACCESS_TOKEN>"

Get item details

This example shows how to authenticate to get the details of an from your organization's .

cURLcURLHTTP
1
2
3
curl https://www.arcgis.com/sharing/rest/content/items/<ITEM_ID> \
-d 'f=pjson' \
-d 'token=<YOUR_ACCESS_TOKEN>'

Tutorials

Create an API key

Create and configure API key credentials to get a long-lived API key access token.


Sign in with user authentication

Create OAuth credentials for app authentication

Create and configure OAuth credentials to set up app authentication.


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

You can no longer sign into this site. Go to your ArcGIS portal or the ArcGIS Location Platform dashboard to perform management tasks.

Your ArcGIS portal

Create, manage, and access API keys and OAuth 2.0 developer credentials, hosted layers, and data services.

Your ArcGIS Location Platform dashboard

Manage billing, monitor service usage, and access additional resources.

Learn more about these changes in the What's new in Esri Developers June 2024 blog post.

Close