A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://developers.arcgis.com/documentation/security-and-authentication/how-to-use-authentication/ below:

How to use authentication | Documentation

ArcGIS uses token-based authentication. All service requests made to secure resources must include an access token for authorization.

The general steps to implement authentication in your application are:

Prerequisites

You need to select a type of authentication that matches your use case. To choose a type of authentication, go to Types of authentication.

1. Create developer credentials

The first step in authentication is to create a set of developer credentials. Developer credentials are a type of item that contain the properties and values required for authentication.

API key authentication requires a set of API key credentials. These credentials are used to generate API keys and determine their privileges. Please review the product and account requirements for API key authentication prior to creation.

The steps to create API key credentials for API key authentication are:

  1. Sign in to your ArcGIS portal.

  2. Click Content > My content > New item and select Developer credentials.

  3. In the Credential types menu, select API key credentials.

  4. Set the credential privileges to determine the operations your API key will be authorized to perform.

  5. Set the credential item access privileges to determine the items your API key will be authorized to access.

  6. Review your selections and, when you are ready, click Generate token. Save the API key as you will not be able to view it again.

Topic

To learn more, go to API key credentials.

User authentication requires a set of OAuth credentials. These credentials are used to generate a client ID for your application and authorize redirect URLs. Please review the product and account requirements for user authentication prior to creation.

The steps to create OAuth credentials for user authentication are:

  1. Sign in to your ArcGIS portal.

  2. Click Content > My content > New item and select Developer credentials.

  3. If your account has the Generate API keys privilege, you will see the Credential types menu. If this menu appears, select OAuth credentials.

  4. Add a redirect URL and click Next.

  5. If your account has the Assign privileges to OAuth 2.0 applications privilege, you will see additional menus titled Privileges and Grant item access. Click Next; these are not required for user authentication.

  6. Name the credentials and click Next to review. When you are ready to create the credentials, click Create.

Topic

To learn more, go to OAuth credentials (for user authentication).

App authentication requires a set of OAuth credentials. These credentials determine the privileges available to your application, and are used to generate a client ID and client secret. Please review the product and account requirements for app authentication prior to creation.

The steps to create OAuth credentials for app authentication are:

  1. Sign in to your ArcGIS portal.

  2. Click Content > My content > New item and select Developer credentials.

  3. If your account has the Generate API keys privilege, you will see the Credential types menu. If this menu appears, select OAuth credentials.

  4. Add a redirect URL and click Next. This URL is required during creation, but will not be used in app authentication.

  5. Set the credential privileges to determine the services and operations your application will be authorized to access.

  6. Set the credential item access privileges to determine the items your application will be authorized to access.

  7. Review your selections and, when you are ready, click Generate credentials.

Topic

To learn more, go to OAuth credentials (for app authentication).

2. Get an access token

The next step is to get an access token by implementing a type of authentication. The implementation details depend on the type of authentication you choose:

3. Make a request

Once you have an access token, you can use it in your application to make requests to secure resources.

Tip

Using an access token does not guarantee the request will be successful. Access tokens must have the correct set of privileges to access the resource and perform the operation requested. Learn more in Privileges.

Mapping APIs Display a basemap

If you use API key authentication with an ArcGIS API, the API key value is typically set once when the application is initialized and is applied every time a service request is made.

The examples below show how to use an API key to access the basemap styles service.

ArcGIS Maps SDK for JavaScript ArcGIS Maps SDK for JavaScript ArcGIS Maps SDK for .NET ArcGIS Maps SDK for Kotlin ArcGIS Maps SDK for Swift ArcGIS Maps SDK for Java ArcGIS Maps SDK for Qt ArcGIS API for Python Esri Leaflet MapLibre GL JS OpenLayers

Expand

Use dark colors for code blocks Copy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
      esriConfig.apiKey = "YOUR_ACCESS_TOKEN"
      const map = new Map({
        basemap: "arcgis/topographic", // Basemap layer
      })

      const view = new MapView({
        map: map,
        center: [-118.805, 34.027],
        zoom: 13, // scale: 72223.819286
        container: "viewDiv",
        constraints: {
          snapToZoom: false,
        },
      })

If you use user authentication with an ArcGIS Maps SDK, the AuthenticationManager or IdentityManager classes automatically handle authentication with the access token, requiring no additional action from you.

The examples below show how to display a map in apps that implement user authentication.

ArcGIS Maps SDK for JavaScript ArcGIS Maps SDK for JavaScript ArcGIS Maps SDK for .NET ArcGIS Maps SDK for Kotlin ArcGIS Maps SDK for Swift ArcGIS Maps SDK for Qt

Expand

Use dark colors for code blocks Copy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
        function handleSignedIn() {

            map = new Map({
                basemap: "arcgis/topographic" // basemap styles service
            });
            const view = new MapView({
                map: map,
                center: [-118.805, 34.027], // Longitude, latitude
                zoom: 13, // Zoom level
                container: "viewDiv" // Div element
            });

        }

If you use app authentication, the access token returned from the /oauth2/token endpoint can be used directly in requests.

The examples below show how to display a map using an access token.

ArcGIS Maps SDK for JavaScript ArcGIS Maps SDK for JavaScript ArcGIS API for Python Esri Leaflet MapLibre GL JS OpenLayers

Use dark colors for code blocks Copy

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
      esriConfig.apiKey = "YOUR_ACCESS_TOKEN"
      const map = new Map({
        basemap: "arcgis/topographic", // Basemap layer
      })

      const view = new MapView({
        map: map,
        center: [-118.805, 34.027],
        zoom: 13, // scale: 72223.819286
        container: "viewDiv",
        constraints: {
          snapToZoom: false,
        },
      })
ArcGIS REST APIs

Access tokens returned from all three types of authentication can be used in REST API requests. To make a direct request to ArcGIS resources, you can use an HTTP request and include the access token as the token parameter. The format to access most REST API endpoints is as follows:

Use dark colors for code blocks Copy

1
https://<RESOURCE_URL>?token=<YOUR_ACCESS_TOKEN>
Tip

Your access token must have the correct privileges to make a REST request to your chosen endpoint.

Geocode an address

This example shows how to authenticate a request to the geocoding service.

cURL cURL HTTP

Use dark colors for code blocks Copy

1
2
3
4
curl https://geocode-api.arcgis.com/arcgis/rest/services/World/GeocodeServer/findAddressCandidates \
-d "f=pjson" \
-d "address=1600 Pennsylvania Ave NW, DC" \
-d "token=<YOUR_ACCESS_TOKEN>"

Use dark colors for code blocks Copy

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
{
    "spatialReference": {
      "wkid": 4326,
      "latestWkid": 4326
    },
    "candidates": [
      {
        "address": "1600 Pennsylvania Ave NW, Washington, District of Columbia, 20500",
        "location": {
          "x": -77.036548499999995,
Get item details

This example shows how to authenticate to get the details of an item from your organization's portal service.

cURL cURL HTTP

Use dark colors for code blocks Copy

1
2
3
curl https://www.arcgis.com/sharing/rest/content/items/<ITEM_ID> \
-d 'f=pjson' \
-d 'token=<YOUR_ACCESS_TOKEN>'

Use dark colors for code blocks Copy

1
2
3
4
5
6
7
8
9
10
11
{
    "id": "ITEM_ID",
    "owner": "OWNER",
    "orgId": "ORG_ID",
    "created": "DATE_CREATED",
    "modified": "DATE_MODIFIED",
    "guid": null,
    "name": null,
    "title": "ITEM_TITLE",
    "type": "ITEM_TYPE"
Topic

For more examples of authenticated REST API requests, go to Access tokens.

Tutorials

Create an API key

Create and configure API key credentials to get a long-lived API key access token.


Sign in with user authentication

Create an application that requires users to sign in with an ArcGIS account.


Create OAuth credentials for app authentication

Create and configure OAuth credentials to set up app authentication.



RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4