Method UseApiKey
UseApiKey(IArcGISConfiguration, string)
Adds a default API key that allows your app to access ArcGIS location services and private portal items.
Declaration
public static IArcGISConfiguration UseApiKey(this IArcGISConfiguration configuration, string apiKey)
Parameters
| Type | Name | Description |
|---|---|---|
| IArcGISConfiguration | configuration | ArcGIS Configuration |
| string | apiKey | A string containing the API key. |
Returns
| Type | Description |
|---|---|
| IArcGISConfiguration | A reference to this instance after the operation has completed. |
Remarks
An API key is a unique long-lived access token that is used to authenticate and monitor requests to ArcGIS location services and private portal items. You can create and manage an API key using your portal when you sign in with an ArcGIS Location Platform account or an ArcGIS Online account with administrator access or a custom role that has the `Generate API keys` privilege. To learn how to create and manage API keys, go to the Create an API Key tutorial. You must ensure that your API key has the correct privileges to access secure resources.
If the user is authenticated with the ArcGIS.com Portal, an API key is not needed to access ArcGIS Online location services. See CreateAsync(Uri?, bool).
See Also
Applies to
Platforms and versions
| Target | Versions |
|---|---|
| .NET Standard 2.0 | 200.0 - 200.8 |
| .NET | 200.0 - 300.0 |
| .NET Windows | 200.0 - 300.0 |
| .NET Android | 200.0 - 300.0 |
| .NET iOS | 200.0 - 300.0 |
| .NET Framework | 200.0 - 200.8 |
| UWP | 200.0 - 200.8 |