Create a service token for NetApp Console local deployment
Create a service access token that can be used by applications and scripts to make REST API calls to NetApp Console local deployment. Service tokens are obtained using the OAuth 2.0 client credentials grant type with a client ID and client secret.
To create service access token, you need a service account. If you don't have a service account, create one in your local deployment using the steps for client secret authentication in Register a service with the NetApp Console.
|
|
Private key JWT authentication is not supported for service accounts in the Console local deployment. Only client ID and client secret authentication is available. |
The following credentials are required:
-
client_idThe client ID assigned to the service account.
-
client_secretThe client secret generated for the service account.
Create the service access token
Learn about the HTTP methods, resource path, and input parameters you need to generate a service access token that you can use to authorize API requests.
The following table shows the HTTP method and resource path required in this API call.
| HTTP method | Resource path |
|---|---|
POST |
|
curl --request POST \
--url https://<host>/oauth/token \
--header 'content-type: application/json' \
--data '{
"client_id": "<client-id>",
"client_secret": "<client-secret>",
"grant_type": "client_credentials"
}'
The following table shows the required input parameters.
| Parameter | Description |
|---|---|
grant_type |
Must be set to client_credentials |
client_id |
The client ID assigned to the service account on the NetApp Console local deployment instance. |
client_secret |
The client secret generated for the service account. |
The JSON input example includes the required input parameters.
{
"grant_type": "client_credentials",
"client_id": "<client_id>",
"client_secret": "<client_secret>"
}
The JSON output includes the access token and expiry as shown in the following example:
{
"access_token": "<access_token>",
"expires_in": 21600,
"token_type": "Bearer"
}
Include the token in the Authorization request header for REST API calls as needed, as shown in the following example:
Authorization: Bearer <access_token>