Interface
Authentication can be supplied to request via ArcGISIdentityManager, ApplicationCredentialsManager or APIKeyManager. These classes implement {@linkCode IAuthenticationManager}.
const session = new ArcGISIdentityManager({
username: "jsmith",
password: "123456",
// optional
portal: "https://[yourserver]/arcgis/sharing/rest"
})
request(url, { authentication: session })Properties
| Property | Type | Notes |
|---|---|---|
canRefresh | boolean | Optional. Should return |
portal | string | Defaults to 'https://www.arcgis.com/sharing/rest'. |
Methods
| Method | Returns | Notes |
|---|---|---|
getDomainCredentials(url) | RequestCredentials | Optional. Returns the proper |
getToken(url, requestOptions?) | Promise<string> | Returns the proper token for a given URL and request options. |
getUser() | Promise<IUser> | Optional. Returns a promise that resolves with the user. Used internally by some methods to check if the user is an admin but can be used as a generic way to get user information. |
getUsername() | Promise<string> | Optional. Returns a promise that resolves with the username. Used internally by some methods to consruct URLs that require a username. |
refreshCredentials(requestOptions?) | Promise<IAuthenticationManager> | Optional. Refresh the stored credentials. |
getDomainCredentials
getDomainCredentials(url: string): RequestCredentialsOptional. Returns the proper credentials option for fetch for a given domain.
See trusted server. Used internally by underlying request methods to add support for specific security considerations.
Parameters
| Parameter | Type | Notes |
|---|---|---|
url | string | The url of the request |
Returns
RequestCredentials"include" or "same-origin"
getToken
Interface MethodgetToken(url: string, requestOptions?: ITokenRequestOptions): Promise<string>Returns the proper token for a given URL and request options.
Parameters
| Parameter | Type | Notes |
|---|---|---|
url | string | The requested URL. |
request | ITokenRequestOptions | the requests options. |
Returns
Promise<string>getUser
getUser(): Promise<IUser>Optional. Returns a promise that resolves with the user. Used internally by some methods to check if the user is an admin but can be used as a generic way to get user information.
Returns
Promise<IUser>getUsername
getUsername(): Promise<string>Optional. Returns a promise that resolves with the username. Used internally by some methods to consruct URLs that require a username.
Returns
Promise<string>refreshCredentials
refreshCredentials(requestOptions?: ITokenRequestOptions): Promise<IAuthenticationManager>Optional. Refresh the stored credentials.
Parameters
| Parameter | Type |
|---|---|
request | ITokenRequestOptions |
Returns
Promise<IAuthenticationManager>