Step 1: Add SDK Dependency

To get started, incorporate the OTPLESS SDK into your project. Update your app’s build.gradle file by adding the following dependency:

implementation 'io.github.otpless-tech:otpless-android-sdk:2.4.0'

Make sure to synchronize your Gradle project to fetch the dependency.

Step 2: Configure AndroidManifest.xml

Modify your AndroidManifest.xml to include an intent filter within the activity responsible for sign-up or sign-in. This setup is crucial for handling deep links.

  <action android:name="android.intent.action.VIEW" />
  <category android:name="android.intent.category.DEFAULT" />
  <category android:name="android.intent.category.BROWSABLE" />
  <data android:host="otpless" android:scheme="otpless.your_app_id_in_lowercase" />

Replace YOUR_APP_ID with your actual App ID provided in your OTPLESS dashboard.

Additionally, ensure your activity is set to singleTop launch mode and exported attribute is true:


Step 3: Configure Your Signup/Sign In Activity

First, import necessary classes from the OTPLESS SDK:

import com.otpless.main.OtplessManager;
import com.otpless.main.OtplessView;
import com.otpless.dto.HeadlessRequest;
import com.otpless.dto.HeadlessResponse;
import com.otpless.dto.HeadlessChannelType;

Declare an OtplessView instance:

OtplessView otplessView;

Within your onCreate() method, initialize and set up the OTPLESS Sign in:

// Initialise OtplessView
otplessView = OtplessManager.getInstance().getOtplessView(this);

Replace YOUR_APP_ID with your actual App ID provided in your OTPLESS dashboard.

Step 4: Handle Callback

Implement a callback method to handle the response from the OTPLESS SDK:

private void onHeadlessCallback(@NonNull final HeadlessResponse response) {
  if (response.getStatusCode() == 200) {
    JSONObject successResponse = response.getResponse();
  } else {
    String error = response.getResponse().optString("errorMessage");

Override onNewIntent()

Ensure you override the onNewIntent() method to correctly handle intent verification:

if (otplessView != null) {

Step 5: Handle Back Press

Override the onBackPressed() method to manage back press actions properly:

// make sure you call this code before super.onBackPressed();
if (otplessView.onBackPressed()) return;

Step 6: Initiate Authentication

Initiate the authentication process for phone number verification by selecting the appropriate verification method.

If Smart Auth and Silent Network Authentication are Enabled on your Dashboard , no additional code is required for Silent Network Authentication. Simply integrate any of the verification methods for Phone Auth.

Initiate OTP:

To initiate an OTP for phone number verification, set the phone number and country code for the OTP request.

Verify OTP:

To verify the OTP entered by the user, set the phone number, country code and otp for the verification request.

Object Attributes

channelYesThe authentication method selected by the user.
phoneConditionalUser’s phone number (required if channel is PHONE).
countryCodeConditionalCountry code of the phone number (required if channel is PHONE).
emailConditionalUser’s email (required if channel is EMAIL).
channelTypeConditionalType of social login initiated (required if channel is OAUTH).

🏁 Checkpoint

To ensure a smooth integration process:

  1. Deploy your app/website with the included OTPLESS SDK.
  2. Conduct tests to verify the sign-in flow functions correctly.
  3. Ensure that after a successful sign-in, the user is redirected back to your app/website and their information is correctly logged in the console.

User Information Response Structure

The structure of the user information returned upon successful sign-in is as follows:

  "status": "SUCCESS",
  "token": "unique_token_here",
  "userId": "unique_user_id_here",
  "timestamp": "ISO_timestamp_here",
  "identities": [
       "identityType": "EMAIL",
      "identityValue": "",
      "channel": "OAUTH",
      "methods": [
      "name": "User Name",
      "verified": true,
      "verifiedAt": "ISO_timestamp_here",
      "isCompanyEmail": "true"
  "idToken": "jwt_token",
  "network": {
    "ip": "",
    "timezone": "Asia/Kolkata",
    "ipLocation": {}
  "deviceInfo": {},
  "sessionInfo": {},
  "firebaseInfo": {},

You can check out a complete sample response here.

Next Steps