Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add passwordless #8127

Merged
merged 17 commits into from
Nov 26, 2024
Merged
Show file tree
Hide file tree
Changes from 15 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -1614,6 +1614,7 @@
"ampx",
"autodetection",
"jamba",
"webauthn",
"knowledgebases",
"rehype"
],
Expand Down
6 changes: 6 additions & 0 deletions src/directory/directory.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@ export const directory = {
{
path: 'src/pages/[platform]/build-a-backend/auth/concepts/phone/index.mdx'
},
{
path: 'src/pages/[platform]/build-a-backend/auth/concepts/passwordless/index.mdx'
},
{
path: 'src/pages/[platform]/build-a-backend/auth/concepts/user-attributes/index.mdx'
},
Expand Down Expand Up @@ -137,6 +140,9 @@ export const directory = {
{
path: 'src/pages/[platform]/build-a-backend/auth/manage-users/manage-passwords/index.mdx'
},
{
path: 'src/pages/[platform]/build-a-backend/auth/manage-users/manage-webauthn-credentials/index.mdx'
},
{
path: 'src/pages/[platform]/build-a-backend/auth/manage-users/manage-devices/index.mdx'
},
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
import { getCustomStaticPath } from '@/utils/getCustomStaticPath';

export const meta = {
title: 'Passwordless',
description: 'Learn how to configure passwordless sign-in flows',
platforms: [
'android',
'angular',
'javascript',
'nextjs',
'react',
'react-native',
'swift',
'vue'
]
};

export function getStaticPaths() {
return getCustomStaticPath(meta.platforms);
}

export function getStaticProps() {
return {
props: {
meta
}
};
}

Amplify supports the use of passwordless authentication flows using the following methods:

- [SMS-based one-time password (SMS OTP)](#sms-otp)
- [Email-based one-time password (Email OTP)](#email-otp)
- [WebAuthn passkey](#webauthn-passkey)

Passwordless authentication removes the security risks and user friction associated with traditional passwords.
{/* add more color */}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

?


<Callout warning>

**Warning:** Passwordless configuration is currently not available in `defineAuth`. We are currently working towards enabling support for passwordless configurations. [Visit the GitHub issue to track the progress](https://github.com/aws-amplify/amplify-backend/issues/2276)

</Callout>

{/* need a section about what a "preferred" factor is */}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

?


## SMS OTP

SMS-based authentication uses phone numbers as the identifier and text messages as the verification channel. At a high level end users will perform the following steps to authenticate:

1. User enters their phone number to sign up/sign in
2. They receive a text message with a time-limited code
3. After the user enters their code they are authenticated

{/* quick blurb of basic usage */}
<InlineFilter filters={["angular", "javascript", "nextjs", "react", "react-native", "vue"]}>

{/* */}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

?


</InlineFilter>
<InlineFilter filters={["android"]}>

{/* */}

</InlineFilter>

<InlineFilter filters={["swift"]}>

{/* */}

</InlineFilter>

<Callout info>

SMS-based one-time password requires your Amazon Cognito user pool to be configured to use Amazon Simple Notification Service (SNS) to send text messages. [Learn how to configure your auth resource with SNS](/[platform]/build-a-backend/auth/moving-to-production/#sms).

{/* NOTE the linked page will need to be updated with sns instructions */}

</Callout>

[Learn more about using SMS OTP in your application code](/[platform]/build-a-backend/auth/connect-your-frontend/sign-in/#sms-otp).

## Email OTP

Email-based authentication uses email addresses for identification and verification. At a high level end users will perform the following steps to authenticate:

1. User enters their email address to sign up/sign in
2. They receive an email message with a time-limited code
3. After the users enters their code they are authenticated

{/* quick blurb of basic usage */}
<InlineFilter filters={["angular", "javascript", "nextjs", "react", "react-native", "vue"]}>

{/* */}

</InlineFilter>
<InlineFilter filters={["android"]}>

{/* */}

</InlineFilter>
<InlineFilter filters={["swift"]}>

{/* */}

</InlineFilter>

<Callout info>

Email-based one-time password requires your Amazon Cognito user pool to be configured to use Amazon Simple Email Service (SES) to send email messages. [Learn how to configure your auth resource with SES](/[platform]/build-a-backend/auth/moving-to-production/#email).

</Callout>

[Learn more about using email OTP in your application code](/[platform]/build-a-backend/auth/connect-your-frontend/sign-in/#email-otp).

## WebAuthn Passkey

WebAuthn uses biometrics or security keys for authentication, leveraging device-specific security features. At a high level end users will perform the following steps to authenticate:

1. User chooses to register a passkey
2. Their device prompts for biometric/security key verification
3. For future logins, they'll authenticate using the same method

{/* quick blurb of basic usage */}
<InlineFilter filters={["angular", "javascript", "nextjs", "react", "react-native", "vue"]}>

{/* */}

</InlineFilter>
<InlineFilter filters={["android"]}>

{/* */}

</InlineFilter>
<InlineFilter filters={["swift"]}>

{/* */}

</InlineFilter>

[Learn more about using WebAuthn passkeys in your application code](/[platform]/build-a-backend/auth/connect-your-frontend/sign-in/#webauthn-passkeys).

### Managing credentials

{/* quick blurb then segue over to "manage WebAuthn credentials" page */}

[Learn more about managing WebAuthn credentials](/[platform]/build-a-backend/auth/manage-users/manage-webauthn-credentials).
Original file line number Diff line number Diff line change
Expand Up @@ -2030,6 +2030,19 @@ func signIn(username: String, password: String) async {

// Prompt the user to enter the Email MFA code they received
// Then invoke `confirmSignIn` api with the code

case .continueSignInWithFirstFactorSelection(let allowedFactors):
print("Received next step as continue sign in by selecting first factor")
print("Allowed factors \(allowedFactors)")

// Prompt the user to select the first factor they want to use
// Then invoke `confirmSignIn` api with the factor

case .confirmSignInWithPassword:
print("Received next step as confirm sign in with password")

// Prompt the user to enter the password
// Then invoke `confirmSignIn` api with the password

case .continueSignInWithTOTPSetup(let setUpDetails):
print("Received next step as continue sign in by setting up TOTP")
Expand Down
Loading