@@ -127,6 +127,8 @@ The result includes `codeDeliveryDetails` with additional information about the
127
127
</Callout >
128
128
129
129
``` ts
130
+ import { type SignInOutput , confirmSignIn } from ' @aws-amplify/auth' ;
131
+
130
132
async function handleSignInResult(result : SignInOutput ) {
131
133
switch (result .nextStep .signInStep ) {
132
134
case ' CONFIRM_SIGN_IN_WITH_SMS_CODE' : {
@@ -144,9 +146,6 @@ async function handleSignInResult(result: SignInOutput) {
144
146
}
145
147
}
146
148
147
- ```
148
-
149
- ``` ts
150
149
async function confirmMfaCode(mfaCode : string ) {
151
150
const result = await confirmSignIn ({ challengeResponse: mfaCode });
152
151
@@ -163,6 +162,8 @@ After the user enters the code, your implementation must pass the value to Ampli
163
162
164
163
165
164
``` ts
165
+ import { type SignInOutput , confirmSignIn } from ' @aws-amplify/auth' ;
166
+
166
167
async function handleSignInResult(result : SignInOutput ) {
167
168
switch (result .nextStep .signInStep ) {
168
169
case ' CONFIRM_SIGN_IN_WITH_TOTP_CODE' : {
@@ -194,6 +195,8 @@ The result includes `codeDeliveryDetails` with additional information about the
194
195
</Callout >
195
196
196
197
``` ts
198
+ import { type SignInOutput , confirmSignIn } from ' @aws-amplify/auth' ;
199
+
197
200
async function handleSignInResult(result : SignInOutput ) {
198
201
switch (result .nextStep .signInStep ) {
199
202
case ' CONFIRM_SIGN_IN_WITH_EMAIL_CODE' : {
@@ -240,6 +243,8 @@ Once Amplify receives the users selection, you can expect to handle a follow up
240
243
241
244
242
245
``` ts
246
+ import { type SignInOutput , confirmSignIn } from ' @aws-amplify/auth' ;
247
+
243
248
async function handleSignInResult(result : SignInOutput ) {
244
249
switch (result .nextStep .signInStep ) {
245
250
case ' CONTINUE_SIGN_IN_WITH_MFA_SELECTION' : {
@@ -268,6 +273,8 @@ async function handleMfaSelection(mfaType: MfaType) {
268
273
If the next step is ` CONTINUE_SIGN_IN_WITH_EMAIL_SETUP ` , then the user must provide an email address to complete the sign in process. Once this value has been collected from the user, call the ` confirmSignIn ` API to continue.
269
274
270
275
``` ts
276
+ import { type SignInOutput , confirmSignIn } from ' @aws-amplify/auth' ;
277
+
271
278
async function handleSignInResult(result : SignInOutput ) {
272
279
switch (result .nextStep .signInStep ) {
273
280
case ' CONTINUE_SIGN_IN_WITH_EMAIL_SETUP' : {
@@ -294,6 +301,8 @@ Once the authenticator app is set up, the user can generate a TOTP code and prov
294
301
295
302
296
303
``` ts
304
+ import { type SignInOutput , confirmSignIn } from ' @aws-amplify/auth' ;
305
+
297
306
async function handleSignInResult(result : SignInOutput ) {
298
307
switch (result .nextStep .signInStep ) {
299
308
case ' CONTINUE_SIGN_IN_WITH_TOTP_SETUP' : {
@@ -330,6 +339,8 @@ Once Amplify receives the users selection, you can expect to handle a follow up
330
339
- If ` TOTP ` is selected, ` CONTINUE_SIGN_IN_WITH_TOTP_SETUP ` will be the next step.
331
340
332
341
``` ts
342
+ import { type SignInOutput , confirmSignIn } from ' @aws-amplify/auth' ;
343
+
333
344
async function handleSignInResult(result : SignInOutput ) {
334
345
switch (result .nextStep .signInStep ) {
335
346
case ' CONTINUE_SIGN_IN_WITH_MFA_SETUP_SELECTION' : {
@@ -360,6 +371,8 @@ If the next step is `CONFIRM_SIGN_IN_WITH_CUSTOM_CHALLENGE`, Amplify Auth is awa
360
371
For example, your custom challenge Lambda may pass a prompt to the frontend which requires the user to enter a secret code.
361
372
362
373
``` ts
374
+ import { type SignInOutput , confirmSignIn } from ' @aws-amplify/auth' ;
375
+
363
376
async function handleSignInResult(result : SignInOutput ) {
364
377
switch (result .nextStep .signInStep ) {
365
378
case ' CONFIRM_SIGN_IN_WITH_CUSTOM_CHALLENGE' : {
@@ -399,6 +412,8 @@ If the next step is `CONFIRM_SIGN_IN_WITH_NEW_PASSWORD_REQUIRED`, Amplify Auth r
399
412
Prompt the user for a new password and pass it to the ` confirmSignIn ` API.
400
413
401
414
``` ts
415
+ import { type SignInOutput , confirmSignIn } from ' @aws-amplify/auth' ;
416
+
402
417
async function handleSignInResult(result : SignInOutput ) {
403
418
switch (result .nextStep .signInStep ) {
404
419
case ' CONFIRM_SIGN_IN_WITH_NEW_PASSWORD_REQUIRED' : {
@@ -428,6 +443,12 @@ Use the `resetPassword` API to guide the user through resetting their password,
428
443
See the [ reset password] ( /[platform]/build-a-backend/auth/manage-users/manage-passwords/ ) docs for more information.
429
444
430
445
``` ts
446
+ import {
447
+ type ResetPasswordOutput ,
448
+ type SignInOutput ,
449
+ resetPassword ,
450
+ } from ' @aws-amplify/auth' ;
451
+
431
452
async function handleSignInResult(result : SignInOutput ) {
432
453
switch (result .nextStep .signInStep ) {
433
454
case ' RESET_PASSWORD' : {
@@ -476,6 +497,12 @@ The result includes `codeDeliveryDetails` with additional information about the
476
497
</Callout >
477
498
478
499
``` ts
500
+ import {
501
+ type SignInOutput ,
502
+ confirmSignUp ,
503
+ resendSignUpCode ,
504
+ } from ' @aws-amplify/auth' ;
505
+
479
506
async function handleSignInResult(result : SignInOutput ) {
480
507
switch (result .nextStep .signInStep ) {
481
508
case ' CONFIRM_SIGN_UP' : {
@@ -490,17 +517,13 @@ async function handleSignInResult(result: SignInOutput) {
490
517
}
491
518
}
492
519
493
- ```
494
-
495
- ``` ts
496
520
async function handleConfirmSignUp(username : string , confirmationCode : string ) {
497
521
await confirmSignUp ({
498
522
username ,
499
523
confirmationCode ,
500
524
});
501
525
}
502
526
503
-
504
527
```
505
528
506
529
Once the sign up is confirmed, call ` signIn ` again to restart the sign-in flow.
@@ -511,6 +534,8 @@ The sign-in flow is complete when the next step is `DONE`, which means the user
511
534
As a convenience, the ` SignInResult ` also provides the ` isSignedIn ` property, which will be true if the next step is ` DONE ` .
512
535
513
536
``` ts
537
+ import { type SignInOutput } from ' @aws-amplify/auth' ;
538
+
514
539
async function handleSignInResult(result : SignInOutput ) {
515
540
switch (result .nextStep .signInStep ) {
516
541
case ' DONE' : {
@@ -521,7 +546,6 @@ async function handleSignInResult(result: SignInOutput) {
521
546
}
522
547
}
523
548
524
-
525
549
```
526
550
</InlineFilter >
527
551
0 commit comments