Options for the UserSession constructor.

interface IUserSessionOptions {
    clientId?: string;
    password?: string;
    portal?: string;
    provider?: AuthenticationProvider;
    redirectUri?: string;
    refreshToken?: string;
    refreshTokenExpires?: Date;
    refreshTokenTTL?: number;
    server?: string;
    ssl?: boolean;
    token?: string;
    tokenDuration?: number;
    tokenExpires?: Date;
    username?: string;
}

Properties

clientId?: 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?: string

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

portal?: string

The ArcGIS Online or ArcGIS Enterprise portal you want to use for authentication. Defaults to https://www.arcgis.com/sharing/rest for the ArcGIS Online portal.

provider?: AuthenticationProvider

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

redirectUri?: 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?: string

OAuth 2.0 refresh token from a previous user session.

refreshTokenExpires?: Date

Expiration date of the refreshToken

refreshTokenTTL?: number

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

server?: string

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

{
server: "https://sampleserver6.arcgisonline.com/arcgis",
token: "SOSlV3v..",
tokenExpires: new Date(1545415669763)
}
ssl?: boolean

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

token?: string

OAuth 2.0 access token from a previous user session.

tokenDuration?: 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?: Date

Expiration date for the token

username?: string

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