requestId generated by the Create API, performs the silent network handshake, and reports progress through callbacks. Your backend confirms the final result via the Status Check API.
Requirements
Step 1: Add SDK dependency
Add the dependency to yourpubspec.yaml:
pubspec.yaml
Check the latest version of the SDK on pub.dev.
Step 2: Smart Authentication (SNA) setup
- Android
- iOS
- Add the network security config inside
android/app/src/main/AndroidManifest.xml, in your<application>tag:
AndroidManifest.xml
- If your
MainActivityextendsFlutterActivity, change it to extendFlutterFragmentActivityfor lifecycle awareness:
MainActivity.kt
Step 3: Initialize the SDK
Create anOtpless instance, initialize it with your App ID, and register the response callback:
Replace
YOUR_APP_ID with your actual App ID from the OTPLESS dashboard.Step 4: Start SNA with the requestId
Pass therequestId returned by the Create API to start():
Start polling the Status Check API from your backend immediately after calling
start(). The SDK callback and the server status run in parallel.Step 5: Handle callbacks
Callback reference
The SDK works in two steps — initialization andstart() — and each step has its own set of callbacks.
Step 1: Initialization callbacks
Emitted when you initialize the SDK (Step 3).Step 2: Start callbacks
Emitted after you invokestart() (Step 4).
For the
errorCode / statusCode values surfaced in SDK callbacks, see SDK Error Codes.Next step
Status Check API
Confirm the authoritative auth status from your server.