Skip to content

Commit 14ec2ed

Browse files
committed
chore: adding imports for multi step sign in examples
1 parent 35ac251 commit 14ec2ed

File tree

1 file changed

+32
-8
lines changed
  • src/pages/[platform]/build-a-backend/auth/connect-your-frontend/multi-step-sign-in

1 file changed

+32
-8
lines changed

src/pages/[platform]/build-a-backend/auth/connect-your-frontend/multi-step-sign-in/index.mdx

Lines changed: 32 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,8 @@ The result includes `codeDeliveryDetails` with additional information about the
127127
</Callout>
128128

129129
```ts
130+
import { type SignInOutput, confirmSignIn } from '@aws-amplify/auth';
131+
130132
async function handleSignInResult(result: SignInOutput) {
131133
switch (result.nextStep.signInStep) {
132134
case 'CONFIRM_SIGN_IN_WITH_SMS_CODE': {
@@ -144,9 +146,6 @@ async function handleSignInResult(result: SignInOutput) {
144146
}
145147
}
146148

147-
```
148-
149-
```ts
150149
async function confirmMfaCode(mfaCode: string) {
151150
const result = await confirmSignIn({ challengeResponse: mfaCode });
152151

@@ -163,6 +162,8 @@ After the user enters the code, your implementation must pass the value to Ampli
163162

164163

165164
```ts
165+
import { type SignInOutput, confirmSignIn } from '@aws-amplify/auth';
166+
166167
async function handleSignInResult(result: SignInOutput) {
167168
switch (result.nextStep.signInStep) {
168169
case 'CONFIRM_SIGN_IN_WITH_TOTP_CODE': {
@@ -194,6 +195,8 @@ The result includes `codeDeliveryDetails` with additional information about the
194195
</Callout>
195196

196197
```ts
198+
import { type SignInOutput, confirmSignIn } from '@aws-amplify/auth';
199+
197200
async function handleSignInResult(result: SignInOutput) {
198201
switch (result.nextStep.signInStep) {
199202
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
240243

241244

242245
```ts
246+
import { type SignInOutput, confirmSignIn } from '@aws-amplify/auth';
247+
243248
async function handleSignInResult(result: SignInOutput) {
244249
switch (result.nextStep.signInStep) {
245250
case 'CONTINUE_SIGN_IN_WITH_MFA_SELECTION': {
@@ -268,6 +273,8 @@ async function handleMfaSelection(mfaType: MfaType) {
268273
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.
269274

270275
```ts
276+
import { type SignInOutput, confirmSignIn } from '@aws-amplify/auth';
277+
271278
async function handleSignInResult(result: SignInOutput) {
272279
switch (result.nextStep.signInStep) {
273280
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
294301

295302

296303
```ts
304+
import { type SignInOutput, confirmSignIn } from '@aws-amplify/auth';
305+
297306
async function handleSignInResult(result: SignInOutput) {
298307
switch (result.nextStep.signInStep) {
299308
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
330339
- If `TOTP` is selected, `CONTINUE_SIGN_IN_WITH_TOTP_SETUP` will be the next step.
331340

332341
```ts
342+
import { type SignInOutput, confirmSignIn } from '@aws-amplify/auth';
343+
333344
async function handleSignInResult(result: SignInOutput) {
334345
switch (result.nextStep.signInStep) {
335346
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
360371
For example, your custom challenge Lambda may pass a prompt to the frontend which requires the user to enter a secret code.
361372

362373
```ts
374+
import { type SignInOutput, confirmSignIn } from '@aws-amplify/auth';
375+
363376
async function handleSignInResult(result: SignInOutput) {
364377
switch (result.nextStep.signInStep) {
365378
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
399412
Prompt the user for a new password and pass it to the `confirmSignIn` API.
400413

401414
```ts
415+
import { type SignInOutput, confirmSignIn } from '@aws-amplify/auth';
416+
402417
async function handleSignInResult(result: SignInOutput) {
403418
switch (result.nextStep.signInStep) {
404419
case 'CONFIRM_SIGN_IN_WITH_NEW_PASSWORD_REQUIRED': {
@@ -428,6 +443,12 @@ Use the `resetPassword` API to guide the user through resetting their password,
428443
See the [reset password](/[platform]/build-a-backend/auth/manage-users/manage-passwords/) docs for more information.
429444

430445
```ts
446+
import {
447+
type ResetPasswordOutput,
448+
type SignInOutput,
449+
resetPassword,
450+
} from '@aws-amplify/auth';
451+
431452
async function handleSignInResult(result: SignInOutput) {
432453
switch (result.nextStep.signInStep) {
433454
case 'RESET_PASSWORD': {
@@ -476,6 +497,12 @@ The result includes `codeDeliveryDetails` with additional information about the
476497
</Callout>
477498

478499
```ts
500+
import {
501+
type SignInOutput,
502+
confirmSignUp,
503+
resendSignUpCode,
504+
} from '@aws-amplify/auth';
505+
479506
async function handleSignInResult(result: SignInOutput) {
480507
switch (result.nextStep.signInStep) {
481508
case 'CONFIRM_SIGN_UP': {
@@ -490,17 +517,13 @@ async function handleSignInResult(result: SignInOutput) {
490517
}
491518
}
492519

493-
```
494-
495-
```ts
496520
async function handleConfirmSignUp(username: string, confirmationCode: string) {
497521
await confirmSignUp({
498522
username,
499523
confirmationCode,
500524
});
501525
}
502526

503-
504527
```
505528

506529
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
511534
As a convenience, the `SignInResult` also provides the `isSignedIn` property, which will be true if the next step is `DONE`.
512535

513536
```ts
537+
import { type SignInOutput } from '@aws-amplify/auth';
538+
514539
async function handleSignInResult(result: SignInOutput) {
515540
switch (result.nextStep.signInStep) {
516541
case 'DONE': {
@@ -521,7 +546,6 @@ async function handleSignInResult(result: SignInOutput) {
521546
}
522547
}
523548

524-
525549
```
526550
</InlineFilter>
527551

0 commit comments

Comments
 (0)