ApplicationCredentialsManager

Class

Used to authenticate methods in ArcGIS REST JS with oAuth 2.0 application credentials. The instance of ApplicationCredentialsManager can be passed to IRequestOptions.authentication to authenticate requests.

Use dark colors for code blocksCopy
      
1
2
3
4
5
6
import { ApplicationCredentialsManager } from '@esri/arcgis-rest-request';

const session = ApplicationCredentialsManager.fromCredentials({
  clientId: "abc123",
  clientSecret: "••••••"
})

Implements

Constructors

Properties

PropertyTypeNotes
string

Defaults to 'https://www.arcgis.com/sharing/rest'.

portal

portal: string

Defaults to 'https://www.arcgis.com/sharing/rest'.

Methods

MethodReturnsNotes
getToken(url, requestOptions?)
Promise<string>

Returns the proper token for a given URL and request options.

Optional. Refresh the stored credentials.

refreshToken(requestOptions?)
Promise<string>
fromCredentials(options)
 static 

Preferred method for creating an ApplicationCredentialsManager

getToken

getToken(urlstring, requestOptions?ITokenRequestOptions): Promise<string>

Returns the proper token for a given URL and request options.

Parameters
ParameterType
url
string
requestOptions
ITokenRequestOptions
Returns 
Promise<string>

refreshCredentials

refreshCredentials(): Promise<ApplicationCredentialsManager>

Optional. Refresh the stored credentials.

Returns 
Promise<ApplicationCredentialsManager>

refreshToken

refreshToken(requestOptions?ITokenRequestOptions): Promise<string>
Parameters
ParameterType
requestOptions
ITokenRequestOptions
Returns 
Promise<string>

fromCredentials static

Preferred method for creating an ApplicationCredentialsManager

Parameters
Returns 
ApplicationCredentialsManager

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