Get Credentials Token
Description
Get the FortiCWP OAuth 2.0 bearer token by the credentials generated on FortiCWP. Before using this API, first generate a credential on FortiCWP. Follow the guide in Generate Credentials.
/api/v1/auth/credentials/token/
Method: POST
Request Headers
Key |
Value |
Type |
Description |
---|---|---|---|
Authorization | Basic <FortiCWP credentials> | String | Authorization credential generated in FortiCWP |
Content-Type | application/x-www-form-urlencoded | String |
Request Body Parameters
Name | Required | Value | Description |
---|---|---|---|
grant_type | Required | client_credentials |
Sample Request
Request URL |
POST https://www.forticwp.com/api/v1/auth/credentials/token/ |
Request Header |
Authorization: Basic c492a2c2-b542-46fa-9894-d56d287bab1f Content-Type: application/x-www-form-urlencoded |
Request Body |
grant_type=client_credentials |
HTTP |
POST /api/v1/auth/credentials/token/ HTTP/1.1 Host: www.forticwp.com Authorization: Basic f59fb84e-c896-4d38-91f3-1eee401823b6 Content-Type: application/x-www-form-urlencoded Content-Type: application/x-www-form-urlencoded grant_type=client_credentials |
Response Variables
Name |
Type |
Description |
---|---|---|
access_token | String | Access token |
refresh_token | String | Refresh token |
token_type | String | Type of token |
expires |
String |
Timestamp of when the token will expire |
Sample Response
{
"token_type": "bearer",
"expires": 1.585245989931E12,
"access_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzY29wZSI6IkFQSSIsImlzcyI6ImZhdXRoLXNlcnZlciIsImhvc3QiOl2RLHbI",
"refresh_token": "I4WnuRUY0xHEsoNMDvmurq_J45VHyuxa4DRWq5mevlYB1YT1yL2TUAA8vRRNNyOyy5RwEww62j0cAM8yxa4"
}