Revolutionary next-generation passwordless authentication powered by Hawcx Smart Connect technology
Installation
https://github.com/hawcx/hawcx_ios_sdk
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 neededonOtpRequired()
- Called when new user/device verification is neededonAuthSuccess(accessToken: String?, refreshToken: String?, isLoginFlow: Bool)
- 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 succeedsshowError(webLoginErrorCode: WebLoginErrorCode, errorMessage: String)
- Called on errorweb_token
to UserDefaults after successful PIN validationsessionDetails
with browser/location info to UserDefaultsBiometric Authentication
getLastLoggedInUser()
to retrieve the last authenticated userauthenticateV4()
for intelligent passwordless login after biometric successLAContext
authenticateV4()
methodDevice Session Management
clearSessionTokens(forUser: String)
clearUserKeychainData(forUser: String)
⚠️getLastLoggedInUser() -> String
clearLastLoggedInUser()
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 | getLastLoggedInUser() | Shows last email | N/A |
Error Handling
AuthV4ErrorCode
enum with specific error casesSmart Connect Authentication Fails with Network Error
networkError
returned in callbackOTP Verification Fails
otpVerificationFailed
errorBiometric Authentication Issues
Keychain Access Issues
keychainSaveFailed
errorsError Code | Description |
---|---|
networkError | Network connectivity issue or request timeout |
unknownError | Unexpected error occurred |
invalidInput | Invalid email or userid format |
keychainSaveFailed | Failed to save data to iOS Keychain |
clientCryptoError | Cryptographic operation failed on device |
fingerprintError | Failed to generate device fingerprint |
authInitFailed | Authentication initialization failed |
otpVerificationFailed | Invalid or expired OTP |
deviceVerificationFailed | Device registration verification failed |
cipherVerificationFailed | Login cipher verification failed |
internalStateError | SDK internal state corruption |
missingDeviceTokenSession | Session token missing during flow |
missingEr1r2ForRegistration | Cryptographic keys missing |
missingCryptoForLogin | Device keys not found for login |
missingPersistentDeviceToken | Device token not found |