require(["esri/identity/Credential"], (Credential) => { /* code goes here */ });
import Credential from "@arcgis/core/identity/Credential.js";
esri/identity/Credential
Represents a credential object used to access a secure ArcGIS resource.
Property Overview
Name | Type | Summary | Class |
---|---|---|---|
The name of the class. | Accessor | ||
Token expiration time specified as number of milliseconds since 1 January 1970 00:00:00 UTC. | Credential | ||
Indicates that this credential was created to access the ArcGIS Server Administrator REST API. | Credential | ||
The Identity Manager's setOAuthRedirectionHandler returns an object that contains a | Credential | ||
The server url. | Credential | ||
Indicates whether the resources accessed using this credential should be fetched over HTTPS protocol. | Credential | ||
Token generated by the token service using the specified userId and password. | Credential | ||
User associated with the Credential object. | Credential |
Property Details
-
Token expiration time specified as number of milliseconds since 1 January 1970 00:00:00 UTC.
- See also
-
isAdmin
isAdmin Boolean
-
Indicates that this credential was created to access the ArcGIS Server Administrator REST API.
-
oAuthState
oAuthState Object
-
The Identity Manager's setOAuthRedirectionHandler returns an object that contains a
state
property. This information is returned for this property.
-
server
server String
-
The server url.
-
ssl
ssl Boolean
-
Indicates whether the resources accessed using this credential should be fetched over HTTPS protocol.
-
token
token String
-
Token generated by the token service using the specified userId and password.
-
userId
userId String
-
User associated with the Credential object.
Method Overview
Name | Return Type | Summary | Class |
---|---|---|---|
Adds one or more handles which are to be tied to the lifecycle of the object. | Accessor | ||
Destroys the credential. | Credential | ||
Emits an event on the instance. | Credential | ||
Indicates whether there is an event listener on the instance that matches the provided event name. | Credential | ||
Returns true if a named group of handles exist. | Accessor | ||
Registers an event handler on the instance. | Credential | ||
Generates a new token and updates the Credential's token property with the newly acquired token. | Credential | ||
Removes a group of handles owned by the object. | Accessor |
Method Details
-
Inherited from Accessor
Since: ArcGIS Maps SDK for JavaScript 4.25Accessor since 4.0, addHandles added at 4.25. -
Adds one or more handles which are to be tied to the lifecycle of the object. The handles will be removed when the object is destroyed.
// Manually manage handles const handle = reactiveUtils.when( () => !view.updating, () => { wkidSelect.disabled = false; }, { once: true } ); this.addHandles(handle); // Destroy the object this.destroy();
ParametershandleOrHandles WatchHandle|WatchHandle[]Handles marked for removal once the object is destroyed.
groupKey *optionalKey identifying the group to which the handles should be added. All the handles in the group can later be removed with Accessor.removeHandles(). If no key is provided the handles are added to a default group.
-
Destroys the credential. When the credential is destroyed, you should remove any map layers that are using this credential. Any tokens generated via OAuth will automatically be revoked.
- See also
-
hasHandles
InheritedMethodhasHandles(groupKey){Boolean}
Inherited from AccessorSince: ArcGIS Maps SDK for JavaScript 4.25Accessor since 4.0, hasHandles added at 4.25. -
Returns true if a named group of handles exist.
ParametergroupKey *optionalA group key.
ReturnsType Description Boolean Returns true
if a named group of handles exist.Example// Remove a named group of handles if they exist. if (obj.hasHandles("watch-view-updates")) { obj.removeHandles("watch-view-updates"); }
-
on
on(type, listener){Object}
-
Registers an event handler on the instance. Call this method to hook an event with a listener.
ParametersReturnsType Description Object Returns an event handler with a remove()
method that should be called to stop listening for the event(s).Property Type Description remove Function When called, removes the listener from the event. Exampleview.on("click", function(event){ // event is the event handle returned after the event fires. console.log(event.mapPoint); });
-
Generates a new token and updates the Credential's token property with the newly acquired token. Tokens are typically kept valid using a timer that automatically triggers a refresh before the token expires. Use this method in cases where the timer has been delayed or stopped.
-
Inherited from Accessor
Since: ArcGIS Maps SDK for JavaScript 4.25Accessor since 4.0, removeHandles added at 4.25. -
Removes a group of handles owned by the object.
ParametergroupKey *optionalA group key or an array or collection of group keys to remove.
Exampleobj.removeHandles(); // removes handles from default group obj.removeHandles("handle-group"); obj.removeHandles("other-handle-group");
Event Overview
Name | Type | Summary | Class |
---|---|---|---|
|
Fires when a credential object is destroyed. |
Credential | |
|
Fires when the token associated with the credential is updated or changed. |
Credential |
Event Details
-
Fires when a credential object is destroyed. After the credential is destroyed, remove any map layers that use this credential. Any tokens generated via OAuth will automatically be revoked.
- See also