This codelab introduces Multi-Factor Authentication (MFA) concepts using the REL-ID Android SDK. You'll learn how the SDK's challenge-response system works, understand different authentication flows, and master the terminology needed for implementing secure authentication.
What You'll Learn
Understanding the MFA challenge-response architecture
How SDK events map to API responses
Different types of authentication flows and their characteristics
MFA terminology
When and how different challenges are triggered
What You'll Need
Completed RELID Initialization codelab for Android
REL-ID Android SDK installed and configured
Basic understanding of event-driven programming with Kotlin coroutines
Access to the sample app source code for reference
Android-Specific Prerequisites
Android Studio Hedgehog (2023.1.1) or later
Knowledge of Kotlin coroutines and Flow
Understanding of Android lifecycle and ViewModels
The RELID SDK implements Multi-Factor Authentication through a challenge-response mechanism. This system ensures secure, step-by-step verification of user identity through multiple factors.
Core MFA Concepts
Challenge-Response Pattern
The MFA system works on a fundamental challenge-response pattern:
SDK Issues Challenge: The SDK identifies what information it needs
Event Triggered: Your app receives an event through callbacks
User Interaction: App collects required information from user
API Response: App responds with appropriate API call
Flow Continuation: SDK processes response and continues or completes flow
MFA Flow Initialization
After successful SDK initialization, the authentication process begins immediately:
Device-based authentication using biometrics (fingerprint, face recognition) or device passcode.
Key Points:
Only available on supported devices
Managed internally by the SDK
Uses Android BiometricPrompt API
Multi-Factor Authentication (MFA)
Security method requiring users to provide two or more verification factors.
Flow-Specific Terms
Activation
The initial registration process where a user establishes their identity and enrolls their first device.
Device Registration
The process of adding a device to a user's list of trusted devices.
Device Trust
The security relationship between a user account and a registered device, enabling streamlined future authentication.
Session
The authenticated period between successful login and logout, managed through device tokens.
Error Handling Terms
Long Error Code
Detailed numeric error code providing specific information about what went wrong.
Short Error Code
Generic error category for broad error classification.
Error String
Human-readable error message describing the issue and potential solutions.
Points to consider for API Calls
Critical Timing Rules:
Only call APIs in response to events - Never call MFA APIs without receiving the corresponding challenge event
Sequential processing - Wait for current API to complete before handling next challenge
No duplicate calls - Don't retry API calls unless explicitly handling errors
Correct Flow:
getUser event → setUser API → wait for next event → getActivationCode event → setActivationCode API
Incorrect Flow:
setUser API → getUser event (❌ API called before event)
getUser event → setUser API → setUser API (❌ duplicate API calls)
Congratulations! You've mastered the fundamentals of Multi-Factor Authentication (MFA) with the RELID SDK on Android:
✅ Challenge-Response Architecture: Understanding how SDK events map to API responses ✅ Flow Types: Activation, Same Device Login, and New Device Login characteristics ✅ Event Integration: Implementing RDNACallbacks interface for MFA challenge handling ✅ API Patterns: Proper response patterns with coroutines and error handling ✅ MFA Terminology: Essential security and technical concepts ✅ Best Practices: Timing, error handling, and implementation guidelines
Key Concepts Mastered
Challenge System: How the SDK uses events to request information and APIs to receive responses
Flow Differentiation: When and why different authentication flows are used
Event-Driven Architecture: Building responsive authentication experiences with Android patterns
MFA Foundation Knowledge
You now understand:
Why MFA matters: Multiple verification factors provide enhanced security
How challenges work: Event-driven requests for specific authentication information
When flows differ: Device registration state determines authentication requirements
What responses mean: API success/error patterns and proper error handling
Android implementation patterns: Coroutines, callbacks, and reactive state management
Next Steps
With this foundation, you're ready for:
Activation Flow Codelab (Android): Implementing complete first-time user registration
Login Flow Codelab (Android): Building returning user authentication experiences