Skip to content

Tutorial: Create OAuth credentials for user authentication

Learn how to create an OAuth credential to set up user authentication.

OAuth credentials
The developer credentials creation interface in a portal

OAuth credentials are required to set up user authentication. When a user signs in with user authentication, a user token is generated to authorize access to ArcGIS services on their behalf. An OAuth credential includes a client_id and a redirect_uri, which are used to initiate the authentication flow.

This tutorial shows you how to create OAuth credentials for use in user authentication.

Prerequisites

You need an ArcGIS Location Platform account or an ArcGIS Online account.

Steps

Create OAuth credentials

  1. Sign in to your portal.

  2. In your portal, click Content > My content > New item.

  3. Click Developer credentials.

  4. Click OAuth 2.0 credentials and click Next.

Save the item

After configuring your OAuth credentials, you can save the credentials as a new item.

  1. Under Redirect URLs, add the URL that you want to direct users to after completing authentication. This URL varies based on your application and typically takes the format of "https://<server>[:port]/callback.html" or "http://my-arcgis-app:/auth". This is a valid web page or server endpoint to which a user can be redirected after successful sign in.

    • For example, if you are running an application on https://localhost:8080, add https://localhost:8080/callback.html to the list of redirect URLs. The exact URL depends on the name of your callback page and the programming language you are using.
  2. Under Application environment, select the type of environment your application will run in. This will affect when the OAuth credentials appear in portal search results. Then, click Next.

  3. In the Privileges window, click Next. These properties are not required in user authentication.

  4. In the Item access window, click Skip. These properties are not required in user authentication.

  5. In the Create developer credentials window, set the following properties:

    • Title: My OAuth credentials (for user authentication)
    • Folder: Developer credentials (Create a new folder)
    • Tags: User authentication
    • Description: Describe the application that these developer credentials will be used in.

    Click Next.

  6. In the Summary window, review the properties and redirect URL you have set.

  7. Click Create to create your OAuth credentials.

Copy the client ID and redirect URL

Your OAuth credentials contain a client_id parameter that is required to implement user authentication. Copy this value, as well as your provided redirect URL, and paste them into your application.

  1. On the item page of your OAuth credentials, scroll down to Credentials.

  2. Copy the Client ID value and paste it into your application.

  3. Click the Manage button to go to the Settings tab.

  4. Under Redirect URLs, copy the redirect URL you provided earlier. Paste it into your application.

Now you have a client ID and a redirect URL to enable user authentication in your application.

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