exchangeToken

exchangeToken

Function
exchangeToken(tokenstring, clientIdstring, portalstring): Promise<string>

Request app-specific token, passing in the token for the current app.

This call returns a token after performing the same checks made by validateAppAccess. It returns an app-specific token of the signed-in user only if the user has access to the app and the encrypted platform cookie is valid.

A scenario where an app would use this is if it is iframed into another platform app and receives credentials via postMessage. Those credentials contain a token that is specific to the host app, so the embedded app would use exchangeToken to get one that is specific to itself.

Note: This is only usable by Esri applications hosted on arcgis.com, esri.com or within an ArcGIS Enterprise installation. Custom applications can not use this.

Parameters
ParameterTypeDefaultNotes
token
string
clientId
string

application

portal
string
"https://www.arcgis.com/sharing/rest"
Returns 
Promise<string>

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

You can no longer sign into this site. Go to your ArcGIS portal or the ArcGIS Location Platform dashboard to perform management tasks.

Your ArcGIS portal

Create, manage, and access API keys and OAuth 2.0 developer credentials, hosted layers, and data services.

Your ArcGIS Location Platform dashboard

Manage billing, monitor service usage, and access additional resources.

Learn more about these changes in the What's new in Esri Developers June 2024 blog post.

Close