Skip to content

Commit 8e52a2e

Browse files
committed
expand autosignin examples
1 parent a456563 commit 8e52a2e

File tree

1 file changed

+32
-7
lines changed
  • src/pages/[platform]/build-a-backend/auth/connect-your-frontend/sign-up

1 file changed

+32
-7
lines changed

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

Lines changed: 32 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -543,7 +543,7 @@ Your application's users can also sign up using passwordless methods. To learn m
543543
```typescript
544544
// Sign up using a phone number
545545
const { nextStep: signUpNextStep } = await signUp({
546-
username: 'james',
546+
username: 'hello',
547547
options: {
548548
userAttributes: {
549549
phone_number: '+15555551234',
@@ -566,7 +566,7 @@ if (signUpNextStep.signUpStep === 'CONFIRM_SIGN_UP') {
566566

567567
// Confirm sign up with the OTP received
568568
const { nextStep: confirmSignUpNextStep } = await confirmSignUp({
569-
username: 'james',
569+
username: 'hello',
570570
confirmationCode: '123456',
571571
});
572572

@@ -691,10 +691,10 @@ func confirmSignUp(for username: String, with confirmationCode: String) -> AnyCa
691691
```typescript
692692
// Sign up using an email address
693693
const { nextStep: signUpNextStep } = await signUp({
694-
username: 'james',
694+
username: 'hello',
695695
options: {
696696
userAttributes: {
697-
email: 'james@example.com',
697+
email: 'hello@example.com',
698698
},
699699
},
700700
});
@@ -714,7 +714,7 @@ if (signUpNextStep.signUpStep === 'CONFIRM_SIGN_UP') {
714714

715715
// Confirm sign up with the OTP received
716716
const { nextStep: confirmSignUpNextStep } = await confirmSignUp({
717-
username: 'james',
717+
username: 'hello',
718718
confirmationCode: '123456',
719719
});
720720

@@ -837,19 +837,44 @@ func confirmSignUp(for username: String, with confirmationCode: String) -> AnyCa
837837
<InlineFilter filters={["angular", "javascript", "nextjs", "react", "react-native", "vue"]}>
838838

839839
```typescript
840-
// Confirm sign up with the OTP received and auto sign in
840+
// Call `signUp` API with `USER_AUTH` as the authentication flow type for `autoSignIn`
841+
const { nextStep: signUpNextStep } = await signUp({
842+
username: 'hello',
843+
options: {
844+
userAttributes: {
845+
846+
phone_number: '+15555551234',
847+
},
848+
autoSignIn: {
849+
authFlowType: 'USER_AUTH',
850+
},
851+
},
852+
});
853+
854+
if (signUpNextStep.signUpStep === 'CONFIRM_SIGN_UP') {
855+
console.log(
856+
`Code Delivery Medium: ${signUpNextStep.codeDeliveryDetails.deliveryMedium}`,
857+
);
858+
console.log(
859+
`Code Delivery Destination: ${signUpNextStep.codeDeliveryDetails.destination}`,
860+
);
861+
}
862+
863+
// Call `confirmSignUp` API with the OTP received
841864
const { nextStep: confirmSignUpNextStep } = await confirmSignUp({
842-
username: 'james',
865+
username: 'hello',
843866
confirmationCode: '123456',
844867
});
845868

846869
if (confirmSignUpNextStep.signUpStep === 'COMPLETE_AUTO_SIGN_IN') {
870+
// Call `autoSignIn` API to complete the flow
847871
const { nextStep } = await autoSignIn();
848872

849873
if (nextStep.signInStep === 'DONE') {
850874
console.log('Successfully signed in.');
851875
}
852876
}
877+
853878
```
854879
</InlineFilter>
855880
<InlineFilter filters={["android"]}>

0 commit comments

Comments
 (0)