OAuthInfo

AMD: require(["esri/identity/OAuthInfo"], (OAuthInfo) => { /* code goes here */ });
ESM: import OAuthInfo from "@arcgis/core/identity/OAuthInfo";
Class: esri/identity/OAuthInfo
Inheritance: OAuthInfo Accessor
Since: ArcGIS API for JavaScript 4.0

This class contains information about an OAuth 2.0 configuration. Use it in combination with the IdentityManager widget to aid in working with OAuth 2.0 authentication.

See also:

Constructors

new OAuthInfo(properties)
Parameter:
properties Object
optional

See the properties for a list of all the properties that may be passed into the constructor.

Example:
require(["esri/identity/OAuthInfo", "esri/identity/IdentityManager"],
function (OAuthInfo, esriId)
{
  let info = new OAuthInfo({
    appId: "<put client id here>",
    popup: true
  });

  esriId.registerOAuthInfos([info]);
})

Property Overview

Any properties can be set, retrieved or listened to. See the Working with Properties topic.
Show inherited properties Hide inherited properties
Name Type Summary Class
Stringmore details

The registered application id.

more detailsOAuthInfo
Stringmore details

Applications with the same value will share the stored token on the same host.

more detailsOAuthInfo
Stringmore details

The name of the class.

more detailsAccessor
Numbermore details

The number of minutes that the token is valid.

more detailsOAuthInfo
Booleanmore details

Set this property to true to force the user to sign in with the id in userId.

more detailsOAuthInfo
Stringmore details

The locale for the OAuth sign in page.

more detailsOAuthInfo
Numbermore details

The minimum time in minutes before a saved token is due to expire that it should still be considered valid for use.

more detailsOAuthInfo
Booleanmore details

Set to true to show the OAuth sign in page in a popup window.

more detailsOAuthInfo
Stringmore details

Applicable if working with the popup user-login workflow.

more detailsOAuthInfo
Stringmore details

The window features passed to window.open().

more detailsOAuthInfo
Stringmore details

The ArcGIS Enterprise portal URL.

more detailsOAuthInfo
Booleanmore details

Set this property to true when popup is false in order to have the window's location hash value restored after signing in.

more detailsOAuthInfo
Stringmore details

The user id used when forceUserId is true.

more detailsOAuthInfo

Property Details

appId String

The registered application id.

authNamespace String

Applications with the same value will share the stored token on the same host.

Default Value:/ (forward slash)
declaredClass Stringreadonly inherited
Since: ArcGIS API for JavaScript 4.7

The name of the class. The declared class name is formatted as esri.folder.className.

expiration Number

The number of minutes that the token is valid.

Default Value:20160 (two weeks)
forceUserId Boolean
Since: ArcGIS API for JavaScript 4.18

Set this property to true to force the user to sign in with the id in userId. If userId is not set, it'll be updated after the user signs in, and then they'll be required to sign back in as the same user if the token expires.

Default Value:false
See also:
locale String

The locale for the OAuth sign in page. The default locale is based on your browser/OS and the organization locale. You can use the locale property to change this. The locale needs to follow the language dash country code syntax supported by ArcGIS.com.

Default Value:Based on your browser/OS and the organization locale.
minTimeUntilExpiration Number

The minimum time in minutes before a saved token is due to expire that it should still be considered valid for use.

Default Value:30

Set to true to show the OAuth sign in page in a popup window.

Default Value:false
popupCallbackUrl String

Applicable if working with the popup user-login workflow. This is a relative page URL that redirects the user back to the secured application after successful login.

Default Value:"oauth-callback.html"
See also:
popupWindowFeatures String

The window features passed to window.open().

Default Value:height=490,width=800,resizable,scrollbars,status
portalUrl String

The ArcGIS Enterprise portal URL.

Default Value:"https://www.arcgis.com"
preserveUrlHash Boolean
Since: ArcGIS API for JavaScript 4.14

Set this property to true when popup is false in order to have the window's location hash value restored after signing in.

Default Value:false
See also:
userId String
Since: ArcGIS API for JavaScript 4.18

The user id used when forceUserId is true. This is updated after a user signs in, or it can be preset to a specific id.

See also:

Method Overview

Name Return Type Summary Class
OAuthInfomore details

Creates a copy of the OAuthInfo object.

more detailsOAuthInfo
*more details

Creates a new instance of this class and initializes it with values from a JSON object generated from an ArcGIS product.

more detailsOAuthInfo
Objectmore details

Converts an instance of this class to its ArcGIS portal JSON representation.

more detailsOAuthInfo

Method Details

clone(){OAuthInfo}
Since: ArcGIS API for JavaScript 4.4

Creates a copy of the OAuthInfo object.

Returns:
Type Description
OAuthInfo Returns a copy of the OAuthInfo.
fromJSON(json){*}static

Creates a new instance of this class and initializes it with values from a JSON object generated from an ArcGIS product. The object passed into the input json parameter often comes from a response to a query operation in the REST API or a toJSON() method from another ArcGIS product. See the Using fromJSON() topic in the Guide for details and examples of when and how to use this function.

Parameter:
json Object

A JSON representation of the instance in the ArcGIS format. See the ArcGIS REST API documentation for examples of the structure of various input JSON objects.

Returns:
Type Description
* Returns a new instance of this class.
toJSON(){Object}

Converts an instance of this class to its ArcGIS portal JSON representation. See the Using fromJSON() guide topic for more information.

Returns:
Type Description
Object The ArcGIS portal JSON representation of an instance of this class.

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