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 :
200: OK Success 400: Bad Request If grant type is not supported 403: Forbidden If client id is invalid 500: Internal Server Error Unexpected error on server side 400: Bad Request Some of the parameters are empty in the request 403: Forbidden Valid grant type but not allowed for 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 exceed the allowed limit 503: Service Unavailable Resource unavailable due to server side issue
{
"access_token": "some-access-token",
"expires_in": 3600,
"token_type": "Bearer"
}
{
"error": unsupported_grant_type,
"error_description": Grant type <requested-grant-type> not supported
}
{
"error": invalid_client,
"error_description": "Invalid client Id"
}
{
"error": server_error
}
{
"error": invalid_request,
"error_description": Empty parameter(s) in request
}
{
"error": invalid_grant
}
{
"error": access_denied
}
{
"error": invalid_grant,
"error_description": "Invalid authorization code"
}
{
"error": invalid_grant,
"error_description": "Invalid code verifier"
}
{
"error": too_many_requests
}
{
"error": temporarily_unavailable
}
Copy 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>>'