# Fetching User Token

Using the “state” from step 10, “code verifier” from step 12, and the “authorization code” from step 9, you need to make a network call to Truecaller’s backend so as to fetch the access token :

`POST` `https://oauth-account-noneu.truecaller.com/v1/token`

**Headers**

| Name           | Type                              | Description |
| -------------- | --------------------------------- | ----------- |
| Content-Type\* | application/x-www-form-urlencoded |             |
|                | String                            |             |

**Request Body**

| Name           | Type                         | Description                                              |
| -------------- | ---------------------------- | -------------------------------------------------------- |
| grant\_type    | "authorization\_code"        | // hardcoded value                                       |
|                | String                       |                                                          |
| client\_id     | \<YOUR\_CLIENT\_ID>          |                                                          |
| code           | \<USER\_AUTHORISATION\_CODE> | Authorisation code from TcOAuthData callback from step 9 |
| code\_verifier | \<YOUR\_CODE\_VERIFIER>      | From step 12                                             |

200: OK Success&#x20;

{ \
"access\_token": "some-access-token", \
"expires\_in": 3600, \
"token\_type": "Bearer" \
}

\
400: Bad Request -  If grant type is not supported\
403: Forbidden - If client id is invalid\
500: Internal Server Error - Unexpected error on the server side\
400: Bad Request  - Some of the parameters are empty in the request\
403: Forbidden Valid grant type but not allowed for the client\
403: Forbidden Invalid auth code provided\
403: Forbidden Invalid/expired auth code in provided\
403: Forbidden Invalid/expired code verifier is provided\
429: Too Many Requests If the number of requests exceeds the allowed limit\
503: Service Unavailable Resource unavailable due to server-side issue

**Sample cURL request :**

```
curl --location --request POST 'https://oauth-account-noneu.truecaller.com/v1/token' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'grant_type=authorization_code' \
--data-urlencode 'client_id=<<your-client-id>>' \
--data-urlencode 'code=<<authorization_code>>' \
--data-urlencode 'code_verifier=<<your-code-verifier>>'
```


---

# 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.truecaller.com/truecaller-sdk/android/oauth-sdk-3.0.0/integration-steps/integrating-with-your-backend/fetching-user-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.
