validateAppAccess

validateAppAccess

Function
validateAppAccess(tokenstring, clientIdstring, portalstring): Promise<IAppAccess>

Validates that the user has access to the application and if they user should be presented a "View Only" mode

This is only needed/valid for Esri applications that are "licensed" and shipped in ArcGIS Online or ArcGIS Enterprise. Most custom applications should not need or use this.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import { validateAppAccess } from '@esri/arcgis-rest-request';

return validateAppAccess('your-token', 'theClientId')
.then((result) => {
   if (!result.value) {
     // redirect or show some other ui
   } else {
     if (result.viewOnlyUserTypeApp) {
       // use this to inform your app to show a "View Only" mode
     }
   }
})
.catch((err) => {
 // two possible errors
 // invalid clientId: {"error":{"code":400,"messageCode":"GWM_0007","message":"Invalid request","details":[]}}
 // invalid token: {"error":{"code":498,"message":"Invalid token.","details":[]}}
})

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

platform token

clientId
string

application client id

portal
string
"https://www.arcgis.com/sharing/rest"

Optional

Returns 
Promise<IAppAccess>

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