Skip to content

Commit 60e757f

Browse files
author
JoonWon Choi
committed
Revert "Introduce resumable signin feature with the docs"
This reverts commit 3b62c84.
1 parent 3b62c84 commit 60e757f

File tree

1 file changed

+62
-97
lines changed
  • src/pages/[platform]/build-a-backend/auth/connect-your-frontend/sign-in

1 file changed

+62
-97
lines changed

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

Lines changed: 62 additions & 97 deletions
Original file line numberDiff line numberDiff line change
@@ -69,12 +69,12 @@ The quickest way to get started with Amplify Auth in your frontend application i
6969
<InlineFilter filters={["angular", "javascript", "nextjs", "react", "vue"]}>
7070

7171
```ts
72-
import { signIn } from 'aws-amplify/auth';
72+
import { signIn } from 'aws-amplify/auth'
7373

7474
await signIn({
75-
username: '[email protected]',
76-
password: 'hunter2'
77-
});
75+
username: "[email protected]",
76+
password: "hunter2",
77+
})
7878
```
7979

8080
</InlineFilter>
@@ -209,7 +209,7 @@ RxAmplify.Auth.signIn("username", "password")
209209
func signIn(username: String, password: String) async {
210210
do {
211211
let signInResult = try await Amplify.Auth.signIn(
212-
username: username,
212+
username: username,
213213
password: password
214214
)
215215
if signInResult.isSignedIn {
@@ -230,7 +230,7 @@ func signIn(username: String, password: String) async {
230230
func signIn(username: String, password: String) -> AnyCancellable {
231231
Amplify.Publisher.create {
232232
try await Amplify.Auth.signIn(
233-
username: username,
233+
username: username,
234234
password: password
235235
)
236236
}.sink {
@@ -253,43 +253,28 @@ func signIn(username: String, password: String) -> AnyCancellable {
253253

254254
The `signIn` API response will include a `nextStep` property, which can be used to determine if further action is required. It may return the following next steps:
255255

256-
<InlineFilter
257-
filters={['angular', 'javascript', 'react', 'nextjs', 'vue', 'android']}
258-
>
259-
- `CONFIRM_SIGN_IN_WITH_NEW_PASSWORD_REQUIRED` - The user was created with a
260-
temporary password and must set a new one. Complete the process with
261-
`confirmSignIn`. - `CONFIRM_SIGN_IN_WITH_CUSTOM_CHALLENGE` - The sign-in must
262-
be confirmed with a custom challenge response. Complete the process with
263-
`confirmSignIn`. - `CONFIRM_SIGN_IN_WITH_TOTP_CODE` - The sign-in must be
264-
confirmed with a TOTP code from the user. Complete the process with
265-
`confirmSignIn`. - `CONTINUE_SIGN_IN_WITH_TOTP_SETUP` - The TOTP setup process
266-
must be continued. Complete the process with `confirmSignIn`. -
267-
`CONFIRM_SIGN_IN_WITH_SMS_CODE` - The sign-in must be confirmed with a SMS
268-
code from the user. Complete the process with `confirmSignIn`. -
269-
`CONTINUE_SIGN_IN_WITH_MFA_SELECTION` - The user must select their mode of MFA
270-
verification before signing in. Complete the process with `confirmSignIn`. -
271-
`RESET_PASSWORD` - The user must reset their password via `resetPassword`. -
272-
`CONFIRM_SIGN_UP` - The user hasn't completed the sign-up flow fully and must
273-
be confirmed via `confirmSignUp`. - `DONE` - The sign in process has been
274-
completed.
256+
<InlineFilter filters={["angular", "javascript", "react", "nextjs", "vue", "android"]}>
257+
- `CONFIRM_SIGN_IN_WITH_NEW_PASSWORD_REQUIRED` - The user was created with a temporary password and must set a new one. Complete the process with `confirmSignIn`.
258+
- `CONFIRM_SIGN_IN_WITH_CUSTOM_CHALLENGE` - The sign-in must be confirmed with a custom challenge response. Complete the process with `confirmSignIn`.
259+
- `CONFIRM_SIGN_IN_WITH_TOTP_CODE` - The sign-in must be confirmed with a TOTP code from the user. Complete the process with `confirmSignIn`.
260+
- `CONTINUE_SIGN_IN_WITH_TOTP_SETUP` - The TOTP setup process must be continued. Complete the process with `confirmSignIn`.
261+
- `CONFIRM_SIGN_IN_WITH_SMS_CODE` - The sign-in must be confirmed with a SMS code from the user. Complete the process with `confirmSignIn`.
262+
- `CONTINUE_SIGN_IN_WITH_MFA_SELECTION` - The user must select their mode of MFA verification before signing in. Complete the process with `confirmSignIn`.
263+
- `RESET_PASSWORD` - The user must reset their password via `resetPassword`.
264+
- `CONFIRM_SIGN_UP` - The user hasn't completed the sign-up flow fully and must be confirmed via `confirmSignUp`.
265+
- `DONE` - The sign in process has been completed.
275266
</InlineFilter>
276267

277-
<InlineFilter filters={['swift', 'flutter']}>
278-
- `confirmSignInWithNewPassword` - The user was created with a temporary
279-
password and must set a new one. Complete the process with `confirmSignIn`. -
280-
`confirmSignInWithCustomChallenge` - The sign-in must be confirmed with a
281-
custom challenge response. Complete the process with `confirmSignIn`. -
282-
`confirmSignInWithTOTPCode` - The sign-in must be confirmed with a TOTP code
283-
from the user. Complete the process with `confirmSignIn`. -
284-
`continueSignInWithTOTPSetup` - The TOTP setup process must be continued.
285-
Complete the process with `confirmSignIn`. - `confirmSignInWithSMSMFACode` -
286-
The sign-in must be confirmed with a SMS code from the user. Complete the
287-
process with `confirmSignIn`. - `continueSignInWithMFASelection` - The user
288-
must select their mode of MFA verification before signing in. Complete the
289-
process with `confirmSignIn`. - `resetPassword` - The user must reset their
290-
password via `resetPassword`. - `confirmSignUp` - The user hasn't completed
291-
the sign-up flow fully and must be confirmed via `confirmSignUp`. - `done` -
292-
The sign in process has been completed.
268+
<InlineFilter filters={["swift", "flutter"]}>
269+
- `confirmSignInWithNewPassword` - The user was created with a temporary password and must set a new one. Complete the process with `confirmSignIn`.
270+
- `confirmSignInWithCustomChallenge` - The sign-in must be confirmed with a custom challenge response. Complete the process with `confirmSignIn`.
271+
- `confirmSignInWithTOTPCode` - The sign-in must be confirmed with a TOTP code from the user. Complete the process with `confirmSignIn`.
272+
- `continueSignInWithTOTPSetup` - The TOTP setup process must be continued. Complete the process with `confirmSignIn`.
273+
- `confirmSignInWithSMSMFACode` - The sign-in must be confirmed with a SMS code from the user. Complete the process with `confirmSignIn`.
274+
- `continueSignInWithMFASelection` - The user must select their mode of MFA verification before signing in. Complete the process with `confirmSignIn`.
275+
- `resetPassword` - The user must reset their password via `resetPassword`.
276+
- `confirmSignUp` - The user hasn't completed the sign-up flow fully and must be confirmed via `confirmSignUp`.
277+
- `done` - The sign in process has been completed.
293278
</InlineFilter>
294279

295280
For more information on handling the TOTP and MFA steps that may be returned, see [multi-factor authentication](/[platform]/build-a-backend/auth/concepts/multi-factor-authentication/).
@@ -299,22 +284,20 @@ For more information on handling the TOTP and MFA steps that may be returned, se
299284
<InlineFilter filters={["angular", "javascript", "nextjs", "react", "react-native", "vue"]}>
300285

301286
```ts title="src/main.ts"
302-
import { confirmSignIn, signIn } from 'aws-amplify/auth';
287+
import { confirmSignIn, signIn } from 'aws-amplify/auth'
303288

304289
const { nextStep } = await signIn({
305-
username: '[email protected]',
306-
password: 'hunter2'
307-
});
290+
username: "[email protected]",
291+
password: "hunter2",
292+
})
308293

309-
if (nextStep === 'CONFIRM_SIGN_IN_WITH_SMS_CODE') {
294+
if (nextStep === "CONFIRM_SIGN_IN_WITH_SMS_CODE") {
310295
await confirmSignIn({
311-
challengeResponse: '12345'
312-
});
296+
challengeResponse: "12345"
297+
})
313298
}
314299
```
315300

316-
`signIn` API even allows you to continue confirm sign-in process after a redirection to a different location requiring a full browser reload, such as redirecting from a Login Page to a Confirm MFA Code Page in a Multi-Page Application during the sign-in process.
317-
318301
</InlineFilter>
319302
<InlineFilter filters={["android"]}>
320303

@@ -368,40 +351,39 @@ func confirmSignIn() -> AnyCancellable {
368351
</InlineFilter>
369352

370353
{/* double-filter to conditionally display this section for only platforms that have examples */}
371-
372354
<InlineFilter filters={["javascript", "nextjs", "react"]}>
373355

374356
### Practical Example
375357

376358
<InlineFilter filters={["javascript", "nextjs", "react"]}>
377359

378360
```tsx title="src/App.tsx"
379-
import type { FormEvent } from 'react';
380-
import { Amplify } from 'aws-amplify';
361+
import type { FormEvent } from "react"
362+
import { Amplify } from "aws-amplify"
381363
// highlight-next-line
382-
import { signIn } from 'aws-amplify/auth';
383-
import outputs from '../amplify_outputs.json';
364+
import { signIn } from "aws-amplify/auth"
365+
import outputs from "../amplify_outputs.json"
384366

385-
Amplify.configure(outputs);
367+
Amplify.configure(outputs)
386368

387369
interface SignInFormElements extends HTMLFormControlsCollection {
388-
email: HTMLInputElement;
389-
password: HTMLInputElement;
370+
email: HTMLInputElement
371+
password: HTMLInputElement
390372
}
391373

392374
interface SignInForm extends HTMLFormElement {
393-
readonly elements: SignInFormElements;
375+
readonly elements: SignInFormElements
394376
}
395377

396378
export default function App() {
397379
async function handleSubmit(event: FormEvent<SignInForm>) {
398-
event.preventDefault();
399-
const form = event.currentTarget;
380+
event.preventDefault()
381+
const form = event.currentTarget
400382
// ... validate inputs
401383
await signIn({
402384
username: form.elements.email.value,
403-
password: form.elements.password.value
404-
});
385+
password: form.elements.password.value,
386+
})
405387
}
406388

407389
return (
@@ -412,15 +394,14 @@ export default function App() {
412394
<input type="password" id="password" name="password" />
413395
<input type="submit" />
414396
</form>
415-
);
397+
)
416398
}
417399
```
418400

419401
</InlineFilter>
420402
</InlineFilter>
421403

422404
{/* with multi-factor auth */}
423-
424405
## With multi-factor auth enabled
425406

426407
When multi-factor authentication (MFA) is **required** with SMS in your backend auth resource, you will need to pass the phone number during sign-up API call. If you are using the `email` or `username` as the primary sign-in mechanism, you will need to pass the `phone_number` attribute as a user attribute. This will change depending on if you enable SMS, TOTP, or both. Visit the [multi-factor authentication documentation](/[platform]/build-a-backend/auth/concepts/multi-factor-authentication/) to learn more about enabling MFA on your backend auth resource.
@@ -569,28 +550,12 @@ func signUp(username: String, password: String, email: String, phonenumber: Stri
569550

570551
</InlineFilter>
571552

572-
<InlineFilter
573-
filters={[
574-
'angular',
575-
'javascript',
576-
'react',
577-
'nextjs',
578-
'vue',
579-
'flutter',
580-
'android'
581-
]}
582-
>
583-
You will then confirm sign-up, sign in, and receive a `nextStep` in the
584-
sign-in result of type `CONFIRM_SIGN_IN_WITH_SMS_MFA_CODE`. A confirmation
585-
code will also be texted to the phone number provided above. Pass the code you
586-
received to the `confirmSignIn` API:
553+
<InlineFilter filters={["angular", "javascript", "react", "nextjs", "vue", "flutter", "android"]}>
554+
You will then confirm sign-up, sign in, and receive a `nextStep` in the sign-in result of type `CONFIRM_SIGN_IN_WITH_SMS_MFA_CODE`. A confirmation code will also be texted to the phone number provided above. Pass the code you received to the `confirmSignIn` API:
587555
</InlineFilter>
588556

589-
<InlineFilter filters={['swift']}>
590-
You will then confirm sign-up, sign in, and receive a `nextStep` in the
591-
sign-in result of type `confirmSignInWithSMSMFACode`. A confirmation code will
592-
also be texted to the phone number provided above. Pass the code you received
593-
to the `confirmSignIn` API:
557+
<InlineFilter filters={["swift"]}>
558+
You will then confirm sign-up, sign in, and receive a `nextStep` in the sign-in result of type `confirmSignInWithSMSMFACode`. A confirmation code will also be texted to the phone number provided above. Pass the code you received to the `confirmSignIn` API:
594559
</InlineFilter>
595560

596561
<InlineFilter filters={["android", "flutter", "react-native", "swift"]}>
@@ -630,7 +595,7 @@ Amplify.Auth.confirmSignIn("code received via SMS",
630595
```kotlin
631596
try {
632597
val result = Amplify.Auth.confirmSignIn("code received via SMS")
633-
Log.i("AuthQuickstart", "Confirmed signin: $result")
598+
Log.i("AuthQuickstart", "Confirmed signin: $result")
634599
} catch (error: AuthException) {
635600
Log.e("AuthQuickstart", "Failed to confirm signin", error)
636601
}
@@ -699,9 +664,9 @@ To sign in using an external identity provider such as Google, use the `signInWi
699664
<InlineFilter filters={["angular", "javascript", "nextjs", "react", "react-native", "vue"]}>
700665

701666
```ts
702-
import { signInWithRedirect } from 'aws-amplify/auth';
667+
import { signInWithRedirect } from "aws-amplify/auth"
703668

704-
signInWithRedirect({ provider: 'Google' });
669+
signInWithRedirect({ provider: "Google" })
705670
```
706671

707672
<Callout info>
@@ -712,14 +677,13 @@ signInWithRedirect({ provider: 'Google' });
712677

713678
Alternatively if you have configured OIDC or SAML-based identity providers in your auth resource, you can specify a "custom" provider in `signInWithRedirect`:
714679

680+
715681
```ts
716-
import { signInWithRedirect } from 'aws-amplify/auth';
682+
import { signInWithRedirect } from "aws-amplify/auth"
717683

718-
signInWithRedirect({
719-
provider: {
720-
custom: 'MyOidcProvider'
721-
}
722-
});
684+
signInWithRedirect({ provider: {
685+
custom: "MyOidcProvider"
686+
}})
723687
```
724688

725689
### Auto sign-in
@@ -839,12 +803,12 @@ Future<void> socialSignIn() async {
839803
}
840804
}
841805
```
842-
843806
</InlineFilter>
844807
<InlineFilter filters={['android']}>
845808
## Update AndroidManifest.xml
846809

847-
Add the following activity and queries tag to your app's `AndroidManifest.xml` file, replacing `myapp` with your redirect URI prefix if necessary:
810+
Add the following activity and queries tag to your app's `AndroidManifest.xml` file, replacing `myapp` with
811+
your redirect URI prefix if necessary:
848812

849813
```xml
850814
<application ...>
@@ -928,7 +892,8 @@ RxAmplify.Auth.signInWithSocialWebUI(AuthProvider.facebook(), this)
928892
<InlineFilter filters={['swift']}>
929893
## Update Info.plist
930894

931-
Sign-in with web UI requires the Amplify plugin to show up the sign-in UI inside a webview. After the sign-in process is complete it will redirect back to your app. You have to enable this in your app's `Info.plist`. Right click Info.plist and then choose Open As > Source Code. Add the following entry in the URL scheme:
895+
Sign-in with web UI requires the Amplify plugin to show up the sign-in UI inside a webview. After the sign-in process is complete it will redirect back to your app.
896+
You have to enable this in your app's `Info.plist`. Right click Info.plist and then choose Open As > Source Code. Add the following entry in the URL scheme:
932897

933898
```xml
934899

0 commit comments

Comments
 (0)