ArcGISAuthError

Class

This error is thrown when a request encounters an invalid token error. Requests that use ArcGISIdentityManager orApplicationCredentialsManager in the authentication option the authentication manager will automatically try to generate a fresh token using either ArcGISIdentityManager.refreshCredentials orApplicationCredentialsManager.refreshCredentials. If the request with the new token fails you will receive an ArcGISAuthErrorif refreshing the token fails you will receive an instance of ArcGISTokenRequestError.

Use dark colors for code blocksCopy
            
1
2
3
4
5
6
7
8
9
10
11
12
request(someUrl, {
  authentication: identityManager,
  // some additional options...
}).catch(e => {
  if(e.name === "ArcGISAuthError") {
    console.log("Request with a new token failed you might want to have the user authorize again.")
  }

  if(e.name === "ArcGISTokenRequestError") {
    console.log("There was an error refreshing the token you might want to have the user authorize again.")
  }
})
Inheritance: ArcGISAuthErrorArcGISRequestError

Constructors

new ArcGISAuthError(messagestring, codestring | number, response?any, url?string, options?IRequestOptions): ArcGISAuthError

Create a new ArcGISAuthError object.

Parameters
ParameterTypeDefaultNotes
message
string
"AUTHENTICATION_ERROR"

The error message from the API

code
string | number
"AUTHENTICATION_ERROR_CODE"

The error code from the API

response
any

The original response from the API that caused the error

url
string

The original url of the request

options
IRequestOptions

The original options of the request

Returns 
ArcGISAuthError

Properties

PropertyTypeNotes
string | number

The error code returned from the request.

string

Formatted error message. See the Error class for more details.

string

The name of this error. Will always be "ArcGISRequestError" to conform with the Error class.

The options of the original request that caused the error

string

The errror message return from the request.

any

The original JSON response the caused the error.

string

The URL of the original request that caused the error

code

code: string | number

The error code returned from the request.

message

message: string

Formatted error message. See the Error class for more details.

name

name: string

The name of this error. Will always be "ArcGISRequestError" to conform with the Error class.

options

options: IRequestOptions

The options of the original request that caused the error

originalMessage

originalMessage: string

The errror message return from the request.

response

response: any

The original JSON response the caused the error.

url

url: string

The URL of the original request that caused the error

Methods

MethodReturns
retry(getSession, retryLimit)
Promise<unknown>

retry

retry(getSessionIRetryAuthError, retryLimitnumber): Promise<unknown>
Parameters
ParameterTypeDefault
getSession
IRetryAuthError
retryLimit
number
1
Returns 
Promise<unknown>

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