Getting an access token

Ops Center Common Services REST API Reference Guide

Version
10.9.x
File Size
533 KB
Audience
anonymous
Part Number
MK-99OPS003-06
You can get an access token to use for REST API authentication.

If you are an identity provider user, you cannot use this API to obtain an access token.

Execution permission

None.

Request line

POST base-URL/auth/v1/providers/builtin/token

Request message

Object ID
None.
Query parameters
None.
Body
{
  "username" : "TestUser",
  "password" : "password"
}

Attribute

Type

Description

username

string

(Required) Username of the user who wants to acquire an access token

password

string

(Required) Password of the user who wants to acquire an access token

Response message

Body
{
  "access_token" : "access token",
  "expires_in" : 300,
  "token_type" : "bearer"
}

Attribute

Type

Description

access_token

string

Character string that serves as the access token

expires_in

int

Period of validity (in seconds) of the access token

token_type

string

Access token type

A fixed string (bearer) is returned.

Coding example

curl -v -X POST -H "Content-Type:application/json" -s "https://example.com:443/portal/auth/v1/providers/builtin/token" -d @./request.json
Tip: Because this request uses SSL communication, you must either run the curl command with the root certificate of the Common Services server certificate specified for the --cacert option, or run the command with the -k option specified. (The -k option runs the command by ignoring SSL errors.)