Security and authentication


ArcGIS supports secure access to location services and private data. It ensures that only valid, authorized users and services access protected information. To access secure resources, you need to implement an authentication method so your applications can make authenticated requests to services.

An authentication method is the process used obtain an access token. Your app must present an access token whenever it makes an authenticated request to location services. Access tokens define the scope and permissions available to your application. The authentication method you use to get an access token will vary.

There are three kinds of access tokens:

  • API key: a permanent token that grants your application access to ready-to-use services and, with an ArcGIS Developer account, private content (currently in beta).
  • ArcGIS identity (formerly named user): grants a short-lived token, generated via OAuth 2.0, giving your application permission to access the content and services authorized to an existing ArcGIS user's account.
  • Application credentials: grant a short-lived token, generated via OAuth 2.0, authorizing your application to access ready-to-use services.

To make authenticated requests to services, you need to set the token parameter to an access token.

ArcGIS identity

An ArcGIS identity, also known as a named user login, grants a temporary access token giving your application permission to access the content and services authorized to your application user's ArcGIS Online or ArcGIS Enterprise account. This temporary token is created using the OAuth 2.0 protocol and authorizes your application to act on the user's behalf without revealing their secure password to your application. Any service credits your application consumes are billed to the authenticated user's ArcGIS subscription and, during the authenticated period, your app can access your user's content on their behalf.

Use ArcGIS identity when you want to:

  • Ensure users are signed in and authenticated with their own ArcGIS account.
  • Use your app user's credits to pay for their private data, content, or service transactions.
  • Limit the length of time users can be signed in to your app with a temporary token.
  • Distribute your app through ArcGIS Marketplace.
Learn more about ArcGIS identity

API keys

An API key is a permanent access token that grants your public-facing application access to specific, ready-to-use services, and, with an ArcGIS Developer account, private content, items, and limited client referrers (currently in beta).

Use API keys when you want to:

  • Quickly write applications that consume ready-to-use services.
  • Provide access to services without requiring users to sign in with an ArcGIS account.
  • Use an access token that doesn't expire.
Learn more about API keys

Use API keys in your app

An API key can be used to authorize access to specific ArcGIS Online services and resources from your app, as well as to monitor access to those services. An API key is created and managed in the ArcGIS developer dashboard and is tied to your ArcGIS account.

You can set an API key on the ArcGISRuntimeEnvironment, which will apply the key to all requests your app makes for ArcGIS Online services and resources. You can also set an API key on any class that implements ApiKeyResource. When you set an API key for a specific class, it will override any key you may have set on ArcGISRuntimeEnvironment, enabling more granular usage telemetry and management for ArcGIS Online resources used by your app.

Classes that implement ApiKeyResource include:

Application credentials

Application credentials grant a short-lived access token, generated via OAuth 2.0, authorizing your application to access ready-to-use services, such as basemap layers, search, and routing.

Use application credentials when you want to:

  • Access ready-to-use services with a more secure process and a short-lived token.
  • Provide access to services without requiring users to have an ArcGIS account.
Learn more about Application credentials

Choose an authentication method

The choice of which type of authentication to implement is primarily dependent upon the resources required by your application. Also consider the strengths and limitations of the API or SDK technology on which your application is built. Your choice of authentication method is also affected by the API with which you build your application. For example, this API provides an AuthenticationManager, with helper methods and patterns to implement ArcGIS identity workflows.

Your app requires access only to ready-to-use services, such as the basemap layer, geocoding, or routing services.API key
Your app allows users to view and edit private data in ArcGIS.ArcGIS identity
Your app is on a web server or API backend and requires access only to basemaps and geocoding.Application credentials
Your app uses Esri Leaflet, Mapbox GL JS, or OpenLayers.API key
Your app uses an ArcGIS API.API key or ArcGIS identity

Authentication manager

This API contains an AuthenticationManager, available from the ArcGISRuntimeEnvironment, that manages all user authentication when your application connects to secured resources. It provides a central place to configure the authentication challenge handlers and credential stores.

The AuthenticationManager class allows you to manage authentication/security related tasks.

It emits the authenticationChallenge signal whenever an authentication or security issue is encountered anywhere in the API.

The following challenges can be raised by the AuthenticationManager:

  • AuthenticationChallengeType::UsernamePassword - Challenges needing username and/or password authentication.
  • AuthenticationChallengeType::OAuth - Challenges needing an OAuth authorization code.
  • AuthenticationChallengeType::ClientCertificate - Challenges needing a client certificate to be provided.
  • AuthenticationChallengeType::SslHandshake - Challenges needing a response to certain SslError errors, usually an untrusted host due to a self-signed certificate.

To handle authentication challenges in the UI automatically in QML, import the Esri.ArcGISRuntime.Dialogs module and declare the AuthenticationView component. After registering the AuthenticationManager type with QML, populate the authenticationManager property of the view with the AuthenticationManager::instance() exposed from C++ to QML. You can register the AuthenticationManager as a QML type with the following syntax:

Use dark colors for code blocksCopy
qmlRegisterUncreatableType<AuthenticationManager>("Esri.TestNamespace", 1, 0, "AuthenticationManager", "AuthenticationManager is uncreateable");

To see a full example of using the AuthenticationView with the AuthenticationManager, please see the token authentication sample.

It also contains an instance of a CredentialCache which maintains a cache of credentials, in memory, that have been previously used to satisfy authentication challenges. This allows a credential to be reused where appropriate, and prevents unnecessary or duplicate challenges from being issued while accessing secure resources from the same security realm. Caching happens automatically if isCredentialCacheEnabled() is true.

What's Next?

For more information about Security and Authentication, see the Security and Authentication chapter.



Portal user info

Integrated Windows authentication

Token authentication

Create and save a map

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