Skip to main content

Requirements

  • The compileSdk version should be 35.
  • The minimum SDK version supported by the SDK is 21.

Overview

OTPless SDK accepts the user’s identity (phone number or email), authenticates through multiple channels, and returns a secure token upon success.The merchant app sends this token to its backend, which verifies it with the OTPless Server before proceeding with the user journey. SDK Overview Chart

Integration Steps

Step 1: Add SDK Dependency

Add the following dependency in your app’s build.gradle.

Step 2: Update AndroidManifest.xml

Add this intent filter to your LoginActivity in AndroidManifest.xml:
Replace YOUR_APP_ID with your actual App ID provided in your OTPLESS dashboard.
🔍 Example: If your App ID is “AcmeApp123”, scheme becomes otpless.acmeapp123
Additionally, ensure your activity is set to singleTop launch mode and that the exported attribute is true:

Silent Network Authentication (SNA) Setup

  • Make sure that Silent Network Authentication is enabled on the OTPLESS dashboard.
  • Once you have successfully integrated OTPLESS Android SDK in your application, you only have to add the following line in your app’s AndroidManifest file in the <application> tag:

Step 3: Configure your SignIn/SignUp Activity

Import the OtplessController class
Kotlin
Declare a otplessController member in your SignIn/SignUpActivity
Kotlin
Assign the member in onCreate of your SignIn/SignUpActivity, initialize the otplessController and register the callback response method. On initialization is success callback is given in callback method.
Kotlin
Override your SignIn/SignUpActivity onNewIntent and forward the new Intent to otplessController.

Step 4: Starting otpless

Call startOtplessWithLoginPage method from otplessController to start otpless login page.
Kotlin

Step 5: Handle auth response

Extract token from authResponse and validate token with backend apis. Backend documentation
Kotlin

Step 6: Closing otpless

When your login page is closed or login is successful, close the otplessController.
Kotlin

Step 7: Tracking Multiple Events

You can observe all events using:
To track and handle specific event categories, use:

Sample Event JSON Payloads


Validate ID Token

Learn how to securely `validate ID token` returned by OTPLESS android SDK to ensure the authenticity of sign-in events from your backend server.

Validate Token (Opaque)

Learn how to securely `validate token` returned by OTPLESS android SDK to ensure the authenticity of sign-in events from your backend server.