Make a network call to fetch the userInfo using access token from step 14. The response would be corresponding to the scopes granted by the user.
GET
https://oauth-account-noneu.truecaller.com/v1/userinfo
Headers
Name | Type | Description |
---|---|---|
200: OK
{
“sub”: “13627101294235520", “given_name”: “xyz”, “family_name”: “xyz”, “phone_number”: “91xxxxxxxxxx", “email”: “pqr@gmail.com”, “picture”: “https://www.truecaller.com/xyz”, “gender”: “male/female”, “phone_number_country_code”: “IN”, “phone_number_verified”: true, ˇ“address”: { “locality”: “Bangalore”, “postal_code”: “5xxxxx" } }
401: Unauthorized If authentication type is not bearer token
404: Not Found Profile information is not present for the user
500: Internal Server Error Failed to validate token due to server error
401: Unauthorized Token in invalid/ expired
422: Unprocessable Entity openid scope missing in initial request
500: Internal Server Error Unexpected error at server side
Sample cURL request :
Authorization*
"Bearer <ACCESS_TOKEN>"
Insert access token from the previous step - 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 |
---|---|---|
Request Body
Name | Type | Description |
---|---|---|
200: OK Success
{ "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 :
Content-Type*
application/x-www-form-urlencoded
String
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