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.
import { ApplicationCredentialsManager } from '@esri/arcgis-rest-request';
const session = ApplicationCredentialsManager.fromCredentials({
clientId: "abc123",
clientSecret: "••••••"
})
Implements
Constructors
constructor
Class Constructornew ApplicationCredentialsManager(options: IApplicationCredentialsManagerOptions): ApplicationCredentialsManager
Parameters
Parameter | Type |
---|---|
options | IApplicationCredentialsManagerOptions |
Returns
ApplicationCredentialsManager
Properties
Property | Type | Notes |
---|---|---|
string | Defaults to 'https://www.arcgis.com/sharing/rest'. |
portal
Class Propertyportal: string
Defaults to 'https://www.arcgis.com/sharing/rest'.
Methods
Method | Returns | Notes |
---|---|---|
getToken(url, requestOptions?) | Promise<string> | Returns the proper token for a given URL and request options. |
Promise<ApplicationCredentialsManager> | Optional. Refresh the stored credentials. | |
refreshToken(requestOptions?) | Promise<string> | |
fromCredentials(options) | Preferred method for creating an |
getToken
Class MethodgetToken(url: string, requestOptions?: ITokenRequestOptions): Promise<string>
Returns the proper token for a given URL and request options.
Parameters
Parameter | Type |
---|---|
url | string |
request | ITokenRequestOptions |
Returns
Promise<string>
refreshCredentials
Class MethodrefreshCredentials(): Promise<ApplicationCredentialsManager>
Optional. Refresh the stored credentials.
Returns
Promise<ApplicationCredentialsManager>
refreshToken
Class MethodrefreshToken(requestOptions?: ITokenRequestOptions): Promise<string>
Parameters
Parameter | Type |
---|---|
request | ITokenRequestOptions |
Returns
Promise<string>
fromCredentials
fromCredentials(options: IApplicationCredentialsManagerOptions): ApplicationCredentialsManager
Preferred method for creating an ApplicationCredentialsManager
Parameters
Parameter | Type |
---|---|
options | IApplicationCredentialsManagerOptions |
Returns
ApplicationCredentialsManager