> ## Documentation Index
> Fetch the complete documentation index at: https://readme.amana-dev.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Handle UAE Pass callback

> Exchange the UAE Pass authorization code for the user's details after they return from UAE Pass.

<Note>
  UAE Pass sign-in is only for users in the UAE.
</Note>

## Query parameters

<ParamField query="code" type="string">
  Authorization code returned by UAE Pass
</ParamField>

<ParamField query="state" type="string">
  Session state returned by UAE Pass
</ParamField>

<ParamField query="error" type="string">
  Error code if user denied access
</ParamField>

## Response

`200` Success.

<ResponseField name="access_token" type="string" />

<ResponseField name="crmAccessToken" type="string">
  CRM access token, only returned if the user needs manual linking
</ResponseField>

<ResponseField name="manualLinkingToken" type="string">
  The secret key that will be passed to manual linking API.
</ResponseField>

<ResponseField name="newAccount" type="boolean">
  Indicates whether this is a new account (signup) or existing account (login)
</ResponseField>

## Possible Errors

| Error | Possible cause | What to do |
| - | - | - |
| 400 | Invalid or missing field | Check the request against the schema. |
| 401 | Token missing or expired | Log in again or use the refresh token. |
| 403 | IP not whitelisted, or account restricted | Confirm your IP is whitelisted; otherwise contact Amana. |
| 429 / 5xx | Rate limit, or temporary issue on our side | Retry with backoff; contact support if it persists. |

<RequestExample>
  ```bash cURL theme={null}
  curl --request GET \
    --url 'https://gateway.amana.io/uaepass/callback'
  ```

  ```python Python theme={null}
  import requests

  url = "https://gateway.amana.io/uaepass/callback"
  headers = {}

  response = requests.request("GET", url, headers=headers)
  print(response.json())
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch('https://gateway.amana.io/uaepass/callback', {
    method: 'GET',
    headers: {},
  });
  console.log(await response.json());
  ```
</RequestExample>

<ResponseExample>
  ```json 200 theme={null}
  {
    "access_token": "<string>",
    "crmAccessToken": "<string>",
    "manualLinkingToken": "<string>",
    "newAccount": true
  }
  ```

  ```json 400 theme={null}
  {
    "error": "<string>",
    "message": "<string>",
    "details": {}
  }
  ```

  ```json 401 theme={null}
  {
    "error": "<string>",
    "message": "<string>",
    "details": {}
  }
  ```

  ```json 403 theme={null}
  {
    "error": "<string>",
    "message": "<string>"
  }
  ```

  ```json 429 theme={null}
  {
    "error": "<string>",
    "message": "<string>"
  }
  ```

  ```json 500 theme={null}
  {
    "error": "<string>",
    "message": "<string>",
    "details": {}
  }
  ```
</ResponseExample>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.