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

constructor

Class Constructor
new ApplicationCredentialsManager(optionsIApplicationCredentialsManagerOptions): ApplicationCredentialsManager
Parameters
Returns 
ApplicationCredentialsManager

Properties

PropertyTypeNotes
string

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

portal

Class Property
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>

Preferred method for creating an ApplicationCredentialsManager

getToken

Class Method
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

Class Method
refreshCredentials(): Promise<ApplicationCredentialsManager>

Optional. Refresh the stored credentials.

Returns 
Promise<ApplicationCredentialsManager>

refreshToken

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

fromCredentials

static
Class Method
fromCredentials(optionsIApplicationCredentialsManagerOptions): ApplicationCredentialsManager

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.