Class
Used to authenticate methods in ArcGIS REST JS with an API keys. The instance of ApiKeyManager
can be passed to IRequestOptions.authentication
to authenticate requests.
import { ApiKeyManager } from '@esri/arcgis-rest-request';
const apiKey = new ApiKeyManager.fromKey("...");
In most cases however the API key can be passed directly to the IRequestOptions.authentication
.
Implements
Constructors
constructor
Class Constructornew ApiKeyManager(options: IApiKeyOptions): ApiKeyManager
Parameters
Parameter | Type |
---|---|
options | IApiKeyOptions |
Returns
ApiKeyManager
Properties
Property | Type | Notes |
---|---|---|
string | The current portal the user is authenticated with. |
Methods
Method | Returns | Notes |
---|---|---|
getToken(url) | Promise<string> | Gets a token (the API Key). |
fromKey(apiKey) | The preferred method for creating an instance of |
getToken
Class MethodgetToken(url: string): Promise<string>
Gets a token (the API Key).
Parameters
Parameter | Type |
---|---|
url | string |
Returns
Promise<string>
fromKey
static
Class MethodfromKey(apiKey: string): ApiKeyManager
The preferred method for creating an instance of ApiKeyManager
.
Parameters
Parameter | Type |
---|---|
api | string |
Returns
ApiKeyManager