Skip to content

Commit e58c246

Browse files
author
Dillon Nys
committed
docs(auth): Update TOTP snippets
1 parent 9d4726f commit e58c246

File tree

2 files changed

+17
-8
lines changed

2 files changed

+17
-8
lines changed

packages/amplify_core/doc/lib/auth.dart

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,11 +215,15 @@ Future<void> confirmMfaUser(String mfaCode) async {
215215
}
216216
// #enddocregion confirm-signin
217217

218-
// #docregion handle-mfa-selection
218+
// #docregion prompt-user-preference
219219
Future<MfaType> _promptUserPreference(Set<MfaType> allowedTypes) async {
220+
// #enddocregion prompt-user-preference
220221
throw UnimplementedError();
222+
// #docregion prompt-user-preference
221223
}
224+
// #enddocregion prompt-user-preference
222225

226+
// #docregion handle-mfa-selection
223227
Future<void> _handleMfaSelection(MfaType selection) async {
224228
try {
225229
final result = await Amplify.Auth.confirmSignIn(

packages/amplify_core/lib/src/category/amplify_auth_category.dart

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -385,16 +385,19 @@ class AuthCategory extends AmplifyCategory<AuthPluginInterface> {
385385
/// If both SMS MFA and TOTP MFA are enabled and configured for the user, they will be
386386
/// given the choice of which mechanism they'd like to use to continue signing in.
387387
///
388-
/// <?code-excerpt "doc/lib/auth.dart" region="handle-mfa-selection"?>
388+
/// <?code-excerpt "doc/lib/auth.dart" region="prompt-user-preference"?>
389389
/// ```dart
390390
/// Future<MfaType> _promptUserPreference(Set<MfaType> allowedTypes) async {
391-
/// throw UnimplementedError();
391+
/// // ···
392392
/// }
393+
/// ```
393394
///
395+
/// <?code-excerpt "doc/lib/auth.dart" region="handle-mfa-selection"?>
396+
/// ```dart
394397
/// Future<void> _handleMfaSelection(MfaType selection) async {
395398
/// try {
396399
/// final result = await Amplify.Auth.confirmSignIn(
397-
/// confirmationValue: selection.name,
400+
/// confirmationValue: selection.confirmationValue,
398401
/// );
399402
/// return _handleSignInResult(result);
400403
/// } on AuthException catch (e) {
@@ -1296,11 +1299,13 @@ class AuthCategory extends AmplifyCategory<AuthPluginInterface> {
12961299
/// Initiates setup of a time-based one-time passcode (TOTP) MFA method for the
12971300
/// current user.
12981301
///
1299-
/// Your backend must be set up with TOTP MFA enabled prior to calling this method.
1302+
/// **NOTE**: Your backend must be set up with TOTP MFA enabled prior to calling this method.
1303+
///
13001304
/// The [TotpSetupDetails] returned contains a [TotpSetupDetails.getSetupUri]
1301-
/// method which can be used to display a QR code or render a button to open
1302-
/// the user's installed authenticator app. After setup is complete on the user's
1303-
/// end, call [verifyTotpSetup] with a one-time code to complete registration.
1305+
/// method for retrieving the setup URI. This can be used to build a QR code or
1306+
/// a button which opens the user's installed authenticator app. After setup is
1307+
/// complete on the user's end, call [verifyTotpSetup] with a one-time code to
1308+
/// complete registration.
13041309
/// {@endtemplate}
13051310
Future<TotpSetupDetails> setUpTotp({
13061311
TotpSetupOptions? options,

0 commit comments

Comments
 (0)