Skip to content

Obtain/Refresh Access Token

OpenID Connect Token Endpoint 1.0.0

This endpoint allows for obtaining access tokens using the Client Credentials flow in the OpenID Connect protocol.


Servers

Description URL
https://{host}/realms/{realm}/protocol/openid-connect https://{host}/realms/{realm}/protocol/openid-connect

Endpoints


POST /token

Obtain Access Token

Request body

=== "application/x-www-form-urlencoded"

```json
{
    "grant_type": "client_credentials",
    "client_id": "my-client-id",
    "client_secret": "my-client-secret"
}
```
<span class="small-note">⚠️</span>&nbsp;<em class="small-note warning">This example has been generated automatically from the schema and it is not accurate. Refer to the schema for more information.</em>



??? hint "Schema of the request body"
    ```json
    {
        "type": "object",
        "properties": {
            "grant_type": {
                "type": "string",
                "enum": [
                    "client_credentials"
                ],
                "example": "client_credentials"
            },
            "client_id": {
                "type": "string",
                "example": "my-client-id",
                "description": "You can find the value under Merchant/API details"
            },
            "client_secret": {
                "type": "string",
                "example": "my-client-secret",
                "description": "You can find the value under Merchant/API details"
            }
        }
    }
    ```

Response 200 OK

=== "application/json"

```json
{
    "access_token": "eyJz93a...k4laUWw",
    "token_type": "Bearer",
    "refresh_token": "string",
    "expires_in": 3600
}
```
<span class="small-note">⚠️</span>&nbsp;<em class="small-note warning">This example has been generated automatically from the schema and it is not accurate. Refer to the schema for more information.</em>



??? hint "Schema of the response body"
    ```json
    {
        "type": "object",
        "properties": {
            "access_token": {
                "type": "string",
                "example": "eyJz93a...k4laUWw"
            },
            "token_type": {
                "type": "string",
                "example": "Bearer"
            },
            "refresh_token": {
                "type": "string"
            },
            "expires_in": {
                "type": "integer",
                "example": 3600
            }
        }
    }
    ```

Response 400 Bad Request

=== "application/json"

```json
{
    "error": "invalid_request",
    "error_description": "Invalid request parameter"
}
```
<span class="small-note">⚠️</span>&nbsp;<em class="small-note warning">This example has been generated automatically from the schema and it is not accurate. Refer to the schema for more information.</em>



??? hint "Schema of the response body"
    ```json
    {
        "type": "object",
        "properties": {
            "error": {
                "type": "string",
                "example": "invalid_request"
            },
            "error_description": {
                "type": "string",
                "example": "Invalid request parameter"
            }
        }
    }
    ```

Response 401 Unauthorized

=== "application/json"

```json
{
    "error": "invalid_client",
    "error_description": "Invalid client credentials"
}
```
<span class="small-note">⚠️</span>&nbsp;<em class="small-note warning">This example has been generated automatically from the schema and it is not accurate. Refer to the schema for more information.</em>



??? hint "Schema of the response body"
    ```json
    {
        "type": "object",
        "properties": {
            "error": {
                "type": "string",
                "example": "invalid_client"
            },
            "error_description": {
                "type": "string",
                "example": "Invalid client credentials"
            }
        }
    }
    ```

Response 500 Internal Server Error

=== "application/json"

```json
{
    "error": "server_error",
    "error_description": "An unexpected error occurred"
}
```
<span class="small-note">⚠️</span>&nbsp;<em class="small-note warning">This example has been generated automatically from the schema and it is not accurate. Refer to the schema for more information.</em>



??? hint "Schema of the response body"
    ```json
    {
        "type": "object",
        "properties": {
            "error": {
                "type": "string",
                "example": "server_error"
            },
            "error_description": {
                "type": "string",
                "example": "An unexpected error occurred"
            }
        }
    }
    ```