This API call performs an OAuth 2.0 Client Credentials Grant to obtain an access token for authentication and authorization.It enables a client application to authenticate itself with an authorization server and obtain a short-lived token for making secure API calls. The access_token is then used in the Authorization header of API requests to prove the client’s identity and access rights.
Method: POST
https://{appconsole_IP}:{port_number}/oauth2/token/
The following headers must be included in the API request for successful authentication and data submission:
Authorization: DDI Central's OAuth implementation uses the Bearer authentication scheme. Hence, while making API calls, access_token obtained via the OAuth 2.0 Client Credentials Grant must be included in the Authorization header of API requests. This token verifies the client’s identity and ensures appropriate permissions for accessing resources.
The Authorization Header follows the format below:
headers = { "Authorization": "Bearer {bearer_tk}" }
Content-Type: Required in the header to indicate the media type of the resource being sent. It helps the server at the receiving end understand how to process the transmitted request body.
The Content-Type Header follows the format below:
headers ={ "Content-Type": "application/json" }
* - Mandatory parameter.
Copied
{
"client_id":"ab5a442c7d57bd3dcbdc0675e9bdd9f6e6d67d1171b043939ff5",
"client_secret":"8c7f2eb1609125d43e945cee63501dff80c461166ccfe15291",
"grant_type":"client_credentials"
}
The above sample request obtain an access token from the authorization server using the OAuth 2.0 Client Credentials Grant. A backend service or machine (not a user) uses this type of request to authenticate itself to access DDI Central's protected APIs without requiring user interaction..
Copied
{
"access_token":"604c6b3c89688821edc3f852701b636e0c3d76bf5cc153dd76815d08",
"expires_in":1800,
"token_type":"Bearer",
"scope":"read write"
}
You can store this data so that there is no need for authorization each time the end user accesses the registered client application. This completes the authentication.