Security and authentication

ArcGIS supports secure access to and portal items. It ensures that only valid, authorized users and services can access protected information. To access secure ArcGIS resources, you need an that you can obtain by implementing an authentication workflow in your app. The type of authentication you use will depend on the security and access requirements of your app.

There are three types of authentication that can be used to obtain an access token:

  • API key authentication: grants a long-lived access token to authenticate requests to and secure portal items. For more information see the Introduction to API key authentication. Go to the Create an API key tutorial to obtain a new API Key access token using your . You can configure the API key privileges to authorize access to different services and secure portal items.
    • API key access tokens created with an account, from ArcGIS Enterprise in version 11.4 onwards, provide access to secure in an ArcGIS Enterprise .
  • User authentication: grants a short-lived token, generated via OAuth, giving your application permission to access the and secure portal items authorized to an existing ArcGIS user's account.
  • App authentication: grants a short-lived token, generated via OAuth, authorizing your application to access and secure portal items.

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

API key authentication

An API Key can grant your public-facing application access to specific and portal items.

Use when you want to:

  • Quickly write applications that consume .
  • Provide access to services without requiring users to sign in with an .
Learn more about API key authentication

Use an in your ArcGIS Runtime app

An API key, can be used to authorize access to specific and portal items. Go to the Create an API key tutorial to obtain a new access token.

If you set the access token on the AGSArcGISRuntimeEnvironment using this access token, all requests made by your app will be authorized using this token. You can also set an access token on any ArcGIS Runtime class that implements AGSAPIKeyResource . When you set an access token for a specific class, it will override any access token you may have set on AGSArcGISRuntimeEnvironment , enabling more granular usage telemetry and management for resources by using the .

Classes that implement AGSAPIKeyResource include:

User authentication

User authentication is a set of authentication workflows that allow users with an to sign into an application and access ArcGIS , , and resources. The typical authentication protocol used is OAuth2.0. When a user signs into an application with their ArcGIS account, an is generated that authorizes the application to access services and content on their behalf. The resources and functionality available depend on the user type, roles, and privileges of the user's ArcGIS account.

Service your app accesses through user authentication will be billed to the authenticated user's and its associated . If your application will access your users' secure content in ArcGIS or if you plan to distribute your application through ArcGIS Marketplace, you must use .

Implement user authentication when you want to:

  • Ensure users are signed in and authenticated with their own .
  • Use your app user's to pay for their private data, , 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 User authentication

App authentication

grant a short-lived access token, generated via OAuth, authorizing your application to access , such as basemap layers, search, and routing.

Use app authentication when you want to:

  • Access 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 App authentication

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, ArcGIS Runtime APIs provide an AuthenticationManager, with helper methods and patterns to implement user authentication workflows.

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

Authentication manager

ArcGIS Runtime APIs contain an AuthenticationManager, which provides helper methods and patterns for implementing user authentication workflows.

The AGSAuthenticationManager class allows you to manage authentication/security related events.

It raises an AGSAuthenticationChallenge whenever an authentication or security issue is encountered anywhere in the API. It also provides a default challenge handler which displays UI containing information about the challenge and presents appropriate options to the user, for instance, requesting a username and password. If you want to handle authentication challenges yourself, for example to display your own custom UI, you can provide your own delegate

It also maintains a cache (in memory) of credentials that have been previously used to satisfy authentication challenges. This allows credentials to be reused, where appropriate, and prevent unnecessary or duplicate challenges from being issued while accessing secure resources from the same security realm. Additionally, the cache can easily be persisted in the keychain (See enableAutoSyncToKeychainWithIdentifier:accessGroup:acrossDevices: on AGSCredentialCache ) so that if the app is restarted, the cache is automatically pre-populated with saved credentials and the user does not have to sign in again.

What's Next?

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

Tutorials

Samples

Authenticate with OAuth

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.

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