Learn how to create an OAuth credentialclient_id, client_secret, and redirect URIs. They are a type of developer credential.
OAuth credentialsclient_id, client_secret, and redirect URIs. They are a type of developer credential.client and a redirect, 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
Steps
Create OAuth credentials
-
Sign in to your portal.
- ArcGIS Location Platform: Go to https://location.arcgis.com and sign in. In the dashboard, click My portal to go to your portal.
- ArcGIS Online: Go to https://arcgis.com and sign in.
-
In your portal
ArcGIS portal, also known as a portal, is a website with applications and tools that can be used to create, manage, access, and share geospatial content and data. It supports security and authentication, developer credentials, content and data service management, user and group management, and site administration. A portal can be hosted in Esri's infrastructure or your own infrastructure. , click Content > My content > New item. -
Click Developer credentials
Developer credentials are a type of item in a portal that contains parameters for authentication. There are two types of developer credentials: API key credentials and OAuth credentials. . -
Click OAuth 2.0 credentials
OAuth credentials are an item that contains parameters required to implement user authentication or app authentication, including a and click Next.client_id,client_secret, and redirect URIs. They are a type of developer credential.
Need troubleshooting help?
If the Developer credentials option is not visible when creating a new item, your ArcGIS Online account does not have the correct permissions. You need an ArcGIS account with a user type of Creator or higher. Learn more about user types in the ArcGIS Online documentation.
Make sure the redirect URL in your OAuth credential is the same with the redirect URL in your callback page. This URL varies based on your application and typically takes the format of https.
For example, if you are running an application on http, set http as the redirect URL in the index.html file, callback.html file, and the settings of your OAuth credential. They all have to match!
Still need help? Go to the Security and authentication guide.
Save the item
After configuring your OAuth credentials, you can save the credentials as a new item
-
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(for server-based app) or:// <server >[ :port]/authenticate https(for browser-based app). This is a valid web page or server endpoint to which a user can be redirected after successful sign in.:// <server >[ :port]/callback.html - For example, if you are running an application on
https, add://localhost :3000 https(for server-based app) or://localhost :3000/authenticate https(for browser-based app) to the list of redirect URLs. The exact URL depends on the name of your callback page and the programming language you are using.://localhost :3000/callback.html
- For example, if you are running an application on
-
Under Application environment, select the type of environment your application will run in. This will affect when the OAuth credentials appear in portal
ArcGIS portal, also known as a portal, is a website with applications and tools that can be used to create, manage, access, and share geospatial content and data. It supports security and authentication, developer credentials, content and data service management, user and group management, and site administration. A portal can be hosted in Esri's infrastructure or your own infrastructure. search results. Then, click Next. -
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.
- Title:
-
In the Summary window, review the properties and redirect URL you have set.
-
Click Create to create your OAuth credentials
OAuth credentials are an item that contains parameters required to implement user authentication or app authentication, including a .client_id,client_secret, and redirect URIs. They are a type of developer credential.
Copy the client ID and redirect URL
Your OAuth credentialsclient_id, client_secret, and redirect URIs. They are a type of developer credential.client parameter that is required to implement user authentication. Copy this value, as well as your provided redirect URL, and paste them into your application.
-
On the item page
An item page is a web page in ArcGIS Online or the developer dashboard used to access and manage the properties for an item and the content it references such as a web map, hosted layer, or file. of your OAuth credentials, scroll down to Credentials. -
Copy the Client ID value and paste it into your application.
-
Click the Manage button to go to the Settings tab.
-
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.