This documentation is for ArcGIS REST JS 3.x which is no longer maintained. For the latest 4.x documentation see ArcGIS REST JS on the ArcGIS Developer website.



Options for the UserSession constructor.


Property Type Notes
clientId Optional string

Client ID of your application. Can be obtained by registering an application on ArcGIS for Developers, ArcGIS Online or on your instance of ArcGIS Enterprise.

password Optional string

Password for this user. Used in CLI apps where users cannot do OAuth 2.0.

portal Optional string

The ArcGIS Online or ArcGIS Enterprise portal you want to use for authentication. Defaults to for the ArcGIS Online portal.

provider Optional AuthenticationProvider

ArcGIS Authentication is used by default. Specifying an alternative will take users directly to the corresponding provider's OAuth page.

redirectUri Optional string

A valid URL to redirect to after a user authorizes your application. Can be set on ArcGIS for Developers, ArcGIS Online or on your instance of ArcGIS Enterprise.

refreshToken Optional string

OAuth 2.0 refresh token from a previous user session.

refreshTokenExpires Optional Date

Expiration date of the refreshToken

refreshTokenTTL Optional number

Duration (in minutes) that a refresh token will be valid.

server Optional string

An unfederated ArcGIS Server instance known to recognize credentials supplied manually.

  server: "",
  token: "SOSlV3v..",
  tokenExpires: new Date(1545415669763)
ssl Optional boolean

This value is set to true automatically if the ArcGIS Organization requires that requests be made over https.

token Optional string

OAuth 2.0 access token from a previous user session.

tokenDuration Optional number

Duration of requested token validity in minutes. Used when requesting tokens with username and password or when validating the identity of unknown servers. Defaults to two weeks.

tokenExpires Optional Date

Expiration date for the token

username Optional string

The authenticated user's username. Guaranteed to be unique across ArcGIS Online or your instance of ArcGIS Enterprise.

Interface defined in packages/arcgis-rest-auth/src/UserSession.ts:158