Revolutionary next-generation passwordless authentication powered by Hawcx Smart Connect technology
Installation
Initialize SDK
Implement Smart Connect authentication:
Smart Connect Authentication
authenticateV4(userid: String, callback: AuthV4Callback)
- Initiates Smart Connect flowsubmitOtpV4(otp: String)
- Submits OTP for verification when neededcancelV4Auth()
- Cancels ongoing authenticationonOtpRequired()
- Called when new user/device verification is neededonAuthSuccess(accessToken: String?, refreshToken: String?, isLoginFlow: Boolean)
- Called on successful authenticationonError(errorCode: AuthV4ErrorCode, errorMessage: String)
- Called when errors occurWeb Login Approval
webLogin(pin: String, callback: WebLoginCallback)
- Validates PIN from QR codewebApprove(token: String, callback: WebLoginCallback)
- Approves web login sessiononSuccess()
- Called when operation succeedsonError(webLoginErrorCode: WebLoginError, errorMessage: String)
- Called on errorweb_token
to SharedPreferences after successful PIN validationsessionDetails
with browser/location info to SharedPreferencesBiometric Authentication
getLastLoggedInUsername()
to retrieve the last authenticated user (suspend function)authenticateV4()
for intelligent passwordless login after biometric successBiometricManager
authenticateV4()
methodDevice Session Management
suspend fun clearSessionTokens(userid: String): Boolean
suspend fun clearUserKeychainData(userid: String): Boolean
⚠️suspend fun getLastLoggedInUsername(): String
suspend fun clearLastLoggedInUser(): Boolean
Action | Method to Use | User Experience | OTP Required? |
---|---|---|---|
Log Out | clearSessionTokens() | Must use Smart Connect again | ❌ No |
Remove Device | clearUserKeychainData() | Device registration lost | ✅ Yes |
Hide Email Pre-fill | clearLastLoggedInUser() | No change to auth | N/A |
Check Last User | getLastLoggedInUsername() | Shows last email | N/A |
Error Handling
AuthV4ErrorCode
enum with specific error casesSmart Connect Authentication Fails with Network Error
NETWORK_ERROR
returned in callbackOTP Verification Fails
OTP_VERIFICATION_FAILED
errorBiometric Authentication Issues
Keystore Access Issues
KEYCHAIN_SAVE_FAILED
errorsError Code | Description |
---|---|
FINGERPRINT_ERROR | Failed to generate device fingerprint |
KEYCHAIN_SAVE_FAILED | Failed to save data to Android Keystore |
CLIENT_CRYPTO_ERROR | Cryptographic operation failed on device |
AUTH_INIT_FAILED | Authentication initialization failed |
OTP_VERIFICATION_FAILED | Invalid or expired OTP |
DEVICE_VERIFICATION_FAILED | Device registration verification failed |
CIPHER_VERIFICATION_FAILED | Login cipher verification failed |
NETWORK_ERROR | Network connectivity issue or request timeout |
INTERNAL_STATE_ERROR | SDK internal state corruption |
MISSING_DEVICE_TOKEN_SESSION | Session token missing during flow |
UNKNOWN_ERROR | Unexpected error occurred |