Access tokens
What is an access token?
An access token is an authorization string that provides secure access to ArcGIS resources. Your app must present an access token whenever it makes an authenticated request to location services or private content. They define the scope of privileges available to your application, and their properties vary based on the type of authentication used to obtain them. Access tokens are always associated with an ArcGIS account, and service usage with the token will be billed to that account's ArcGIS subscription.
You can get an access token by implementing a type of authentication in your app. Different types of authentication result in access tokens with different privileges.
Types of access tokens
There are two types of access tokens that have different durations.
Type of token | Type of authentication | Description |
---|---|---|
Permanent | API key authentication | Permanent API keys do not expire. They are created, managed, and deleted in the developer dashboard. |
Short-lived | User authentication, app credential authentication | Expires after a set amount of time, usually 30 minutes by default. Privileges vary based on the type of authentication used to obtain them. Short-lived tokens are usually paired with refresh tokens. |
Access token privileges
Access tokens have different privileges depending on the method used to obtain them. The following table compares the privileges of access tokens from different types of authentication.
API key access tokens | User authentication access tokens | App credential authentication access tokens | |
---|---|---|---|
Ready-to-use services | |||
Public content | |||
Secure content | 1 | ||
Subscriber and premium content | |||
Content management services | 2 |
- 1. ArcGIS Developer subscriptions only
- 2. ArcGIS Developer subscriptions only, limited
Access tokens from user authentication are associated with a user's ArcGIS account and access services and content on their behalf. The level of access authorized to a user authentication token is determined by the associated account's roles and privileges.
How to use an access token
You can make use an access token to make an authenticated request to ArcGIS resources. To make authenticated requests to location services, you need to set the token
parameter of the REST API request.
You can also make requests to ArcGIS REST APIs by using an ArcGIS Maps SDK.
Code examples
The following code examples show how to use access tokens to authenticate REST API requests to ArcGIS resources.
Access a basemap style
This example accesses the ArcGIS Outdoor basemap style from the basemap styles service.
Perform geocoding
This example performs a forward geocode by making a request to the geocoding service.
Access a feature service
This example retrieves features from a feature service.
Get item details
This example accesses a private item hosted in ArcGIS.com and retrieves its properties.
Tutorials
Create and manage an API key
Create and configure an API key to access ArcGIS resources.
Register an OAuth 2.0 application
Register an application in the developer dashboard.
Implement user authentication
Authenticate ArcGIS users with OAuth 2.0