This utility method generates a random code verifier string using SecureRandom as the
source of entropy with 64 as the default entropy quantity.
You can either generate your own code verifier or use this utility method to generate one
for you.
NOTE: Store the code verifier in the current session since it would be required later
to generate the access token.
After checking isUsable, you can invoke Truecaller's OAuth consent screen dialog
in your app flow by calling the following method
The result will be returned asynchronously via streamCallbackData stream
Once you initialise the Truecaller SDK using the initializeSDK method, and if you are using
the SDK for verification of only Truecaller users ( by setting the sdkOptions scope as
TcSdkOptions.OPTION_VERIFY_ONLY_TC_USERS, you can check if the Truecaller app is
present on the user's device and whether the user has a valid account state or not and
whether the OAuth flow is supported or not using the following method
This utility method produces a code challenge from the supplied code verifiercodeVerifier
using SHA-256 as the challenge method and Base64 as encoding if the system supports it.
NOTE: All Android devices should ideally support SHA-256 and Base64, but in rare case if
the doesn't, then this method would return null meaning that you can’t proceed further.
Please ensure to have a null safe check for such cases.
This method has to be called before anything else. It initializes the SDK with the
customizable options which are all optional and have default values as set below in the method
This method will initiate manual verification of phoneNumber asynchronously for Indian
numbers only so that's why default countryISO is set to "IN".
The result will be returned asynchronously via streamCallbackData stream
Check TcSdkCallbackResult to understand the different verifications states.
This method may lead to verification with a SMS Code (OTP) or verification with a CALL,
or if the user is already verified on the device, will get the call back as
TcSdkCallbackResult.verifiedBefore in streamCallbackData
Set your own code challenge or use the utility method generateRandomCodeVerifier to generate
one for you and set it via codeChallenge to this method
Set it before calling getAuthorizationCode
Customise the consent screen dialog in any of the supported Indian languages by supplying
locale to the method.
NOTE: Default value is en
Set it before calling getAuthorizationCode
Set a unique state parameter oAuthState & store it in the current session to use it later in the
onSuccess() callback method of the TcOAuthCallback to match if the state received from the
authorization server is the same as set here to prevent request forgery attacks.
Set it before calling getAuthorizationCode
Call this method after requestVerification to complete the verification if the number has
to be verified with a missed call.
i.e call this method only when you receive TcSdkCallbackResult.missedCallReceived
in streamCallbackData.
To complete verification, it is mandatory to pass firstName and lastName of the user