Authentication

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

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

There are two methods for authenticating users and three types of authentication that can be used to obtain an access token:

  • API key: A simple method to authenticate users.
    • API key authentication: This creates a permanent token that grants your application access to location services and, with an ArcGIS developer account, private content.
  • OAuth 2.0: This method uses application credentials to manage and authorize access for authenticated users.
    • User authentication (formerly ArcGIS identity): This generates a short-lived token via OAuth 2.0, authorizing your application to access ArcGIS content, services, and resources on behalf of a logged-in ArcGIS user.
    • App credential authentication: This generates a short-lived token via OAuth 2.0, authorizing a developer's application to access ready-to-use services on their behalf.

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

API key authentication

An API key is a long-term access token that you manually create, configure, and scope using the developer dashboard. Using API keys is typically the easiest way to access ArcGIS location services in your applications.

To use API keys, you need to have one of the following ArcGIS accounts:

  • ArcGIS Developer account
  • ArcGIS Online account

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.
  • Meter service usage to the ArcGIS subscription that owns the API key.

You can set a global API key to use across different scenes in a project.

To set a global API key:

Go to Edit -> Project Settings, in the ArcGIS Maps SDK tab, and enter the API key.

api key

To set an API key for a specific scene:

  1. You need an ArcGIS Developer account or ArcGIS Online account and an API key to access ArcGIS services. If you don't have an account, sign up for free.

  2. Open the Map Creator UI in the Unity Editor, and click the Auth tab.

  3. Set the API key in the API Key field.

With the Map Creator UI, the API key is used for all your content. If you want to use different API keys for each data, use the C# API.



Learn more about API key authentication

Learn how to create and manage an API key on the developer dashboard

OAuth 2.0

OAuth 2.0 is an industry-standard protocol for authorization. ArcGIS stores private user identities and content; 3rd party applications access those resources through a secure OAuth 2.0 user authorization protocol.

Learn more about OAuth 2.0

Learn how to register an OAuth application on the developer dashboard

User authentication

User authentication is a type of authentication that allows users with an ArcGIS account to sign into an application and allow it to access ArcGIS content, services, and resources on their behalf. The typical authorization protocol used is OAuth 2.0. When a user signs into an application, an access token is granted that authorizes the application to access services and content on their behalf. The resources and functionality available to the application depend on the user type, roles, and privileges assigned to the user's ArcGIS account.

Implement user authentication when you want to:

  • Ensure users are signed in and authenticated with their own ArcGIS account.
  • Meter service usage to your app user's ArcGIS subscription 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.

To set up OAuth 2.0 with user authentication:

For the editor mode, there is a sample OAuth challenge handler that allows you to configure OAuth 2.0 with user authentication. To load private data in the Scene view:

  1. Have an ArcGIS account, register an OAuth app, and have a Client ID and Redirect URI for your app to access a private layer. If you don't have an account, sign up for free.
  2. Open the Map Creator UI and click the Auth tab.
  3. In the Add Authentication Configuration section, set a name for the configuration and introduce the Client ID and the Redirect URI for the private content.
  4. Click the Add button.
  5. Click the tab where you have private content, such as Basemap, Elevation, or Layers, and select the configuration name from the Authentication drop-down.
  6. Save and reload the scene.

When you add a configuration, you can find it under the Authentication Configurations section. When you reload your scene, the login window opens in a default web browser window. To add basemap, elevation, and layers, see the Layers section.

For play mode, you should configure another OAuth challenge handler for your own app. You can attach your own script or the OAuth Challenge Handlers Initializer (which uses the sample scripts) to the game object with the ArcGIS Map Component.

  1. Click ArcGIS Map in the Hierarchy window.
  2. In the Inspector window, click the Add Components button.
  3. Select OAuth Challenge Handlers Initializer.

When the secured feature service data is loaded, the login window will open in the default web browser.


Learn more about user authentication

Learn how to add a redirect URI on the developer dashboard

App credential authentication

App credential authentication uses a set of application credentials to grant a short-lived access token generated via OAuth 2.0. The token authorizes 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 app credential authentication

Choose an authentication method

The choice of which type of authentication to implement is mostly dependent upon the resources required by your application.

ScenarioSolution
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.User authentication
Your app is API backend and requires access only to basemaps and geocoding.App credential authentication

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