Truecaller SDK
  • Hello!
  • Why Truecaller SDK
  • Getting Started
  • ANDROID
    • 🆕OAuth SDK 3.0
      • Implementing user flow for your App
      • Scenarios for all user verifications : Truecaller and Non Truecaller Users
      • Integration Steps
        • Generating Client ID
        • Setup
        • Implementing Callbacks
        • Initialisation
        • Setting up OAuth parameters
        • Invocation
        • Customisation
        • Clearing SDK Instance
        • Handling Error Scenarios
        • Integrating with your Backend
          • Fetching User Token
          • Fetching User Profile
        • Non Truecaller User Verification
          • Completing Verification
          • TrueException
          • Server Side Validation
      • Instrumentation
      • Getting Release Ready
        • Testing your verification flow
          • Non-Truecaller user verification flow
          • Truecaller user verification flow
          • Test Setup
        • Google play store app permission declaration form
        • Moving to Production
    • SDK v2.8.0
      • Implementing user flow for your app
      • Scenarios for all user verifications : Truecaller and Non Truecaller Users
      • Generating App Key
      • Integrating with your App
        • Setup
        • App Key Configuration
        • Initialisation
        • Customisation
        • Implement Callbacks
        • Clearing SDK instance
        • Handling Error Scenarios
        • Verifying non Truecaller users
          • TrueException
          • Completing Verification
        • Advanced Steps
      • Server Side Response Validation
        • For Truecaller users verification flow
        • For Non-Truecaller users verification flow
      • Instrumentation
      • Getting Release Ready
        • Testing your verification flow
          • Truecaller user verification flow
          • Non-Truecaller User Verification Flow
          • Test Setup
        • Google Play App Signing
        • Google Play Store app permissions declaration
        • Google Play Policy Change for Device Identifiers
      • Changelog
  • MOBILE WEBSITES
    • Implementing user flow for your Mobile Website
    • Generating App Key
    • Integrating with your mobile website
      • Initialisation
      • Invoking verification
      • Fetch User Profile
      • Completing User Verification
      • Handling Error Scenarios
    • Getting Release Ready
      • Instrumentation
      • Testing your verification flow
  • IOS
    • Generating App Key
    • Integrating with your iOS App
      • Setup
      • Configuration
      • Usage
        • Swift
        • Objective-C
      • Verifying Non-Truecaller app users
        • Completing Verification
      • Handling Error Scenarios
        • Safari Redirection
    • Server Side Response Validation
  • SHOPIFY APP
    • Generating App Key
    • App Configuration
    • Deactivating App Block
  • FAQs
    • General
    • Developer Account
    • Android App SDK
    • Android OAuth SDK
    • Mobile Web SDK
    • Number Verification Plugin
  • PRODUCT UPDATES
    • App Review Process
    • Introducing dark theme
Powered by GitBook
On this page

Was this helpful?

  1. ANDROID
  2. OAuth SDK 3.0
  3. Integration Steps
  4. Integrating with your Backend

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

{ "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 }

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>>'

PreviousIntegrating with your BackendNextFetching User Profile

Last updated 1 year ago

Was this helpful?

🆕