OAuthInfo
require(["esri/identity/OAuthInfo"], function(OAuthInfo) { /* code goes here */ });esri/identity/OAuthInfoThis 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 Objectoptional
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) { var info = new OAuthInfo({ appId: "<put client id here>", popup: true }); esriId.registerOAuthInfos([info]); })
Property Overview
| Name | Type | Summary | Class | |
|---|---|---|---|---|
| String | The registered application id. more details | more details | OAuthInfo | |
| String | Applications with the same value will share the stored token on the same host. more details | more details | OAuthInfo | |
| String | The name of the class. more details | more details | Accessor | |
| Number | The number of minutes that the token is valid. more details | more details | OAuthInfo | |
| Boolean | Set this property to | more details | OAuthInfo | |
| String | The locale for the OAuth sign in page. more details | more details | OAuthInfo | |
| Number | The minimum time in minutes before a saved token is due to expire that it should still be considered valid for use. more details | more details | OAuthInfo | |
| Boolean | Set to | more details | OAuthInfo | |
| String | Applicable if working with the popup user-login workflow. more details | more details | OAuthInfo | |
| String | The window features passed to window.open(). more details | more details | OAuthInfo | |
| String | The ArcGIS Enterprise portal URL. more details | more details | OAuthInfo | |
| Boolean | Set this property to | more details | OAuthInfo | |
| String | The user id used when | more details | OAuthInfo |
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)
- 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 BooleanSince: ArcGIS API for JavaScript 4.18
Set this property to
trueto force the user to sign in with the id inuserId. IfuserIdis 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
- popup Boolean
Set to
trueto 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 BooleanSince: ArcGIS API for JavaScript 4.14
Set this property to
truewhen popup isfalsein order to have the window's location hash value restored after signing in.- Default Value:false
- See also:
- userId StringSince: ArcGIS API for JavaScript 4.18
The user id used when
forceUserIdistrue. 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 | |
|---|---|---|---|---|
| OAuthInfo | Creates a copy of the OAuthInfo object. more details | more details | OAuthInfo | |
| * | Creates a new instance of this class and initializes it with values from a JSON object generated from a product in the ArcGIS platform. more details | more details | OAuthInfo | |
| Object | Converts an instance of this class to its ArcGIS portal JSON representation. more details | more details | OAuthInfo |
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 a product in the ArcGIS platform. The object passed into the input
jsonparameter 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 ObjectA 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.