IAuthenticationManager

Interface

Authentication can be supplied to request via ArcGISIdentityManager, ApplicationCredentialsManager or APIKeyManager. These classes implement Code IAuthenticationManager.

Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
const session = new ArcGISIdentityManager({
  username: "jsmith",
  password: "123456",
  // optional
  portal: "https://[yourserver]/arcgis/sharing/rest"
})

request(url, { authentication: session })

Properties

PropertyTypeNotes
boolean

Optional. Should return true if these credentials can be refreshed and false if it cannot.

string

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

canRefresh

optional
Interface Property
canRefresh: boolean

Optional. Should return true if these credentials can be refreshed and false if it cannot.

portal

Interface Property
portal: string

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

Methods

MethodReturnsNotes
RequestCredentials

Optional. Returns the proper credentials option for fetch for a given domain.

getToken(url, requestOptions?)
Promise<string>

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

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.

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?)

Optional. Refresh the stored credentials.

getDomainCredentials

optional
Interface Method
getDomainCredentials(urlstring): RequestCredentials

Optional. 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
ParameterTypeNotes
url
string

The url of the request

Returns 
RequestCredentials

"include" or "same-origin"

getToken

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

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

Parameters
ParameterTypeNotes
url
string

The requested URL.

requestOptions
ITokenRequestOptions

the requests options.

Returns 
Promise<string>

getUser

optional
Interface Method
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

optional
Interface Method
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

optional
Interface Method
refreshCredentials(requestOptions?ITokenRequestOptions): Promise<IAuthenticationManager>

Optional. Refresh the stored credentials.

Parameters
ParameterType
requestOptions
ITokenRequestOptions
Returns 
Promise<IAuthenticationManager>

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