# Obtain Access Token

The SP web application needs to obtain the access token from the available “code” which is received from UAE PASS in previous step (Obtain Authorization Code).

{% hint style="danger" %}
Token API request should be a back channel request
{% endhint %}

#### <mark style="color:orange;">Access Token API</mark>

<mark style="color:green;">`POST`</mark> <mark style="color:green;">`https://stg-id.uaepass.ae/idshub/token`</mark>

<mark style="color:orange;">**Headers**</mark>

| Name          | Value               |
| ------------- | ------------------- |
| Content-Type  | multipart/form-data |
| Authorization | Basic {credentials} |

#### <mark style="color:orange;">Parameters</mark>

| Name          | Type   | Description                                                                       |
| ------------- | ------ | --------------------------------------------------------------------------------- |
| grant\_type   | string | authorization\_code                                                               |
| redirect\_uri | string | Redirect URI to the application.                                                  |
| code          | string | Authorization code received from previous step. (Obtain Authorization Code step). |

<mark style="color:orange;">**Response**</mark>

In response, UAE PASS issues a bearer-type OAuth 2.0 access token and returns it in a JSON structure.\
JSON object contains the access token and associated information.

{% tabs %}
{% tab title="200" %}
{% code overflow="wrap" %}

```json

{
    "access_token": "856b9b82-2b52-3e20-8aab-36a5d9a97025",
    "scope": "string",
    "token_type": "Bearer",
    "expires_in": expiry time
} 

```

{% endcode %}
{% endtab %}

{% tab title="400" %}

```json
{
  "error": "Invalid request"
}
```

{% endtab %}
{% endtabs %}

#### <mark style="color:orange;">Response parameters</mark>

| Name          | Description                                                                           |
| ------------- | ------------------------------------------------------------------------------------- |
| access\_token | Access token generated by UAE PASS Server                                             |
| token\_type   | Type of access token. Always has the “Bearer” value.                                  |
| expires\_in   | Lifetime (in seconds) of the access token.                                            |
| scope         | Scopes granted to those to which the access token is associated, separated by spaces. |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.uaepass.ae/facial-biometric-transactions-confirmation/web-integration/integration-steps/obtain-access-token.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
