Challenge - 5 Problems
Biometric Authentication Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ ui_behavior
intermediate2:00remaining
Biometric Authentication Button Behavior
What will happen when the user taps the biometric authentication button in this Flutter widget?
Flutter
ElevatedButton(
onPressed: () async {
final isAvailable = await auth.canCheckBiometrics;
if (isAvailable) {
final authenticated = await auth.authenticate(
localizedReason: 'Please authenticate to proceed',
options: const AuthenticationOptions(biometricOnly: true),
);
if (authenticated) {
print('Access granted');
} else {
print('Access denied');
}
} else {
print('Biometrics not available');
}
},
child: const Text('Authenticate'),
)Attempts:
2 left
💡 Hint
Check the flow: canCheckBiometrics is checked before authenticate is called.
✗ Incorrect
The code first checks if biometrics are available. If yes, it calls authenticate and prints 'Access granted' if authentication succeeds.
❓ lifecycle
intermediate1:30remaining
Handling Biometric Authentication State
In a Flutter app using biometric authentication, which lifecycle method is best to check if biometrics are available when the app resumes from background?
Attempts:
2 left
💡 Hint
Think about when the app returns to the foreground.
✗ Incorrect
Checking biometric availability when the app resumes ensures the status is current after backgrounding.
📝 Syntax
advanced1:30remaining
Correct Usage of authenticate() Options
Which option correctly uses the authenticate() method from local_auth package to restrict authentication to biometrics only?
Flutter
final authenticated = await auth.authenticate( localizedReason: 'Authenticate', options: ??? );
Attempts:
2 left
💡 Hint
Look for the option that limits authentication to biometrics.
✗ Incorrect
Setting biometricOnly to true restricts authentication to biometrics only.
🔧 Debug
advanced2:00remaining
Debugging Biometric Authentication Failure
A Flutter app using local_auth package always prints 'Biometrics not available' even on devices with biometrics enabled. What is the most likely cause?
Attempts:
2 left
💡 Hint
Check platform-specific setup for biometric permissions.
✗ Incorrect
Without proper permissions, canCheckBiometrics returns false, causing the app to think biometrics are unavailable.
🧠 Conceptual
expert2:30remaining
Security Implications of Biometric Authentication
Which statement best describes a security consideration when using biometric authentication in mobile apps?
Attempts:
2 left
💡 Hint
Think about what happens if biometrics fail or are unavailable.
✗ Incorrect
Combining biometrics with fallback methods like PIN improves security and usability.