Declare a otplessController member in your SignIn/SignUpActivity
Kotlin
Copy
Ask AI
private lateinit var otplessController: OtplessController
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
Copy
Ask AI
otplessController = OtplessController.getInstance(this)connectController.initializeOtpless(OTPLESS_APP_ID, CctSupportConfig(type = CctSupportType.Cct)) { trackId -> // save it for further tracking of journey}otplessController.registerResultCallback(this::onAuthResponse)
Extract token from authResponse and validate token with backend apis.
Backend documentation
Kotlin
Copy
Ask AI
import com.otpless.loginpage.model.OtplessResultprivate fun onAuthResponse(authResponse: OtplessResult) { val token = authResponse.response.optString("token") // validate token with backend}