ArcGIS supports secure access to ArcGIS services
There are three types of authentication that you can use to get an access token:
-
API key authentication: grants a long-lived access token to authenticate requests to ArcGIS services
A service, also known as an ArcGIS service, is software that supports an ArcGIS REST API and provides geospatial functionality or data. A service can be hosted by Esri or in ArcGIS Enterprise. and secure portal items. For more information see the Introduction to API key authentication. To obtain an API key access token, go to the Create an API key tutorial using your ArcGIS accountAn ArcGIS account is an identity with a user type and set of privileges that can access specific ArcGIS products, tools, APIs, services, and resources. The main account types that can be used for development are an ArcGIS Location Platform account, ArcGIS Online account, and ArcGIS Enterprise account. ArcGIS Location Platform and ArcGIS Online accounts are also associated with a subscription. . Here you can configure the API key privileges to authorize access to different services and portal items. -
User authentication: a collection of authentication workflows that connect your app to a user's ArcGIS account.
- OAuth 2.0: manage ArcGIS authentication and grant a short-lived access token
An access token is an authorization string that provides access to secure ArcGIS content, data, and services. Its capabilities are determined by the privileges it supports. It is obtained by implementing API key authentication, User authentication, or App authentication. generated via OAuth 2.0. This gives your application permission to access ArcGIS secured services authorized to an existing ArcGIS user's account. For more information see the OAuthUserCredential.
- Identity-Aware Proxy: manage identity-aware proxy authentication and grant a short-lived ID token generated from an Identity-Aware Proxy (IAP). This token gives your application permission to access the ArcGIS Enterprise portal and its services that are protected behind an Identity-Aware Proxy (IAP). ArcGIS Maps SDK for Kotlin currently supports the Microsort Entra Application Proxy via the Microsoft Identity Platform. For more information see the IapCredential.
- Generate token: manages ArcGIS authentication and grants a short-lived access token generated via Esri's proprietary token-based authentication mechanism. This gives your application permission to access ArcGIS secured services authorized to an existing ArcGIS user's account. For more information see the TokenCredential and PregeneratedTokenCredential.
- Network credential: manage network authentication (also known as web-tier authentication) for ArcGIS Enterprise. This gives your application permission to access network secured services authorized to your web-tier's identity store user accounts. Supports Public Key Infrastructure (PKI), Integrated Windows Authentication (IWA) and HTTP Basic. For more information see the PasswordCredential and CertificateCredential.
- OAuth 2.0: manage ArcGIS authentication and grant a short-lived access token
-
App authentication: uses the registered application's credentials to access location services
ArcGIS Location Services, also referred to as Location Services, are services hosted by Esri that provide geospatial functionality for developing mapping applications. They include the ArcGIS Basemap Styles service, ArcGIS Static Basemap Tiles service, ArcGIS Places service, ArcGIS Geocoding service, ArcGIS Routing service, ArcGIS GeoEnrichment service, and ArcGIS Elevation service. An ArcGIS Location Platform or ArcGIS Online account is required to use the services. on ArcGIS. It manages ArcGIS authentication and grants a short-lived access tokenAn access token is an authorization string that provides access to secure ArcGIS content, data, and services. Its capabilities are determined by the privileges it supports. It is obtained by implementing API key authentication, User authentication, or App authentication. generated via OAuth 2.0 using the Application itemAn item, also known as a content item, is a resource stored in a portal such as a web map, hosted layer, style, script tool, file, or notebook. 's Client ID and Client Secret outside of the context of a user. For more information see the OAuthApplicationCredential topic.
API key authentication
An API key
Use API key authentication
- Quickly write applications that consume ArcGIS services
A service, also known as an ArcGIS service, is software that supports an ArcGIS REST API and provides geospatial functionality or data. A service can be hosted by Esri or in ArcGIS Enterprise. . - Provide access to services without requiring users to sign in with an ArcGIS account
An ArcGIS account is an identity with a user type and set of privileges that can access specific ArcGIS products, tools, APIs, services, and resources. The main account types that can be used for development are an ArcGIS Location Platform account, ArcGIS Online account, and ArcGIS Enterprise account. ArcGIS Location Platform and ArcGIS Online accounts are also associated with a subscription. .
To authorize your app to access secured resources, obtain an API keyArcGISEnvironment.
ArcGISEnvironment.apiKey = ApiKey.create(YOUR_ACCESS_TOKEN)
val map = remember {
ArcGISMap(basemapStyle = BasemapStyle.ArcGISTopographic)
}
Scaffold {
MapView(
modifier = Modifier
.fillMaxSize()
.padding(it),
arcGISMap = map
)
}
You can view the app's usage telemetry on the respective ArcGIS Location PlatformApiKeyResource. This overrides any access token you have set on the ArcGISEnvironment and enables more granular usage telemetry.
val map = remember {
// Create a new ArcGUS basemap and apply an access token.
val basemap = Basemap(basemapStyle = BasemapStyle.ArcGISTopographic)
basemap.apiKey = ApiKey.create(BuildConfig.YOUR_ACCESS_TOKEN)
// Create a a new map with the basemap.
ArcGISMap(basemap = basemap)
}
Classes that implement ApiKeyResource include:
-
ArcGISSceneLayer -
ArcGISTiledLayer -
ArcGISVectorTiledLayer -
Basemap -
BasemapStylesService -
ClosestFacilityTask -
ExportTileCacheTask -
ExportVectorTilesTask -
GeodatabaseSyncTask -
LocatorTask -
RouteTask -
ServiceAreaTask -
ServiceFeatureTable
User authentication
User authentication is a set of authentication workflows that allow users with an ArcGIS account
Services that your app accesses with user authentication are billed to the authenticated user's ArcGIS account
Implement user authentication when you want to:
- Ensure users are signed in and authenticated with their own ArcGIS account
An ArcGIS account is an identity with a user type and set of privileges that can access specific ArcGIS products, tools, APIs, services, and resources. The main account types that can be used for development are an ArcGIS Location Platform account, ArcGIS Online account, and ArcGIS Enterprise account. ArcGIS Location Platform and ArcGIS Online accounts are also associated with a subscription. . - Use your app user's credits
Credits are the currency used by ArcGIS Online Organization accounts to account for data storage and location service consumption. Credits are consumed for specific transactions, such as accessing location services, and types of storage, such as storing features, performing analytics, and using premium content. to pay for their private data, contentContent is a collection of items in a portal that belong to a user, group, or organization. , 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.
App authentication
App authentication
Use app authentication when you want to:
- Access location services
ArcGIS Location Services, also referred to as Location Services, are services hosted by Esri that provide geospatial functionality for developing mapping applications. They include the ArcGIS Basemap Styles service, ArcGIS Static Basemap Tiles service, ArcGIS Places service, ArcGIS Geocoding service, ArcGIS Routing service, ArcGIS GeoEnrichment service, and ArcGIS Elevation service. An ArcGIS Location Platform or ArcGIS Online account is required to use the services. with a more secure process and a short-lived token. - Provide access to services without requiring users to have an ArcGIS account.
Choose a type of authentication
The following considerations can help determine which type of authentication to implement:
-
Access to resources—Your app can access ArcGIS services
A service, also known as an ArcGIS service, is software that supports an ArcGIS REST API and provides geospatial functionality or data. A service can be hosted by Esri or in ArcGIS Enterprise. and portal items using API key authenticationAPI key authentication is a type of authentication that uses an API key to authenticate requests to ArcGIS services and secure portal items. , User authenticationUser 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 OAuth2.0. , or App authenticationApp authentication is a type of authentication that grants a short-lived access token based on an OAuth 2.0 client ID and client secret, authorizing an application to access ArcGIS services and items. . -
User experience—If you don't want to make users log in, your app can access ArcGIS services
A service, also known as an ArcGIS service, is software that supports an ArcGIS REST API and provides geospatial functionality or data. A service can be hosted by Esri or in ArcGIS Enterprise. using API key authenticationAPI key authentication is a type of authentication that uses an API key to authenticate requests to ArcGIS services and secure portal items. or App authenticationApp authentication is a type of authentication that grants a short-lived access token based on an OAuth 2.0 client ID and client secret, authorizing an application to access ArcGIS services and items. . In this case, users will not need to have an ArcGIS accountAn ArcGIS account is an identity with a user type and set of privileges that can access specific ArcGIS products, tools, APIs, services, and resources. The main account types that can be used for development are an ArcGIS Location Platform account, ArcGIS Online account, and ArcGIS Enterprise account. ArcGIS Location Platform and ArcGIS Online accounts are also associated with a subscription. in order to use your app. -
Usage charges—If you want service usage to be charged to the user's account, your app must request that the user log in using 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 OAuth2.0. . When using API key authenticationAPI key authentication is a type of authentication that uses an API key to authenticate requests to ArcGIS services and secure portal items. or App authenticationApp authentication is a type of authentication that grants a short-lived access token based on an OAuth 2.0 client ID and client secret, authorizing an application to access ArcGIS services and items. , all access to services from your app will be charged to your ArcGIS account.
You might also need to consider the level of security required for your app, how your app will be distributed, and your available ArcGIS products and accounts.
| Scenario | Solution |
|---|---|
| Your app requires access to ArcGIS services | API key authentication or App authentication |
| Your app requires access to location services | User authentication |
| Your app needs to access content that requires an ArcGIS Online subscription | User authentication |
| Your app needs to access private hosted data on your ArcGIS Location Platform account | API key authentication or App authentication |
| Your app allows users to view and edit private data hosted in ArcGIS Online | User authentication |
| You plan to distribute your app through ArcGIS Marketplace. | User authentication |