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

chore(auth): add js passwordless changes #8129

Merged
merged 16 commits into from
Nov 26, 2024

Conversation

scanlonp
Copy link
Contributor

Description of changes:

Add js passwordless changes for all APIs.

Related GitHub issue #, if available:

Instructions

If this PR should not be merged upon approval for any reason, please submit as a DRAFT

Which product(s) are affected by this PR (if applicable)?

  • amplify-cli
  • amplify-ui
  • amplify-studio
  • amplify-hosting
  • amplify-libraries

Which platform(s) are affected by this PR (if applicable)?

  • JS
  • Swift
  • Android
  • Flutter
  • React Native

Please add the product(s)/platform(s) affected to the PR title

Checks

  • Does this PR conform to the styleguide?

  • Does this PR include filetypes other than markdown or images? Please add or update unit tests accordingly.

  • Are any files being deleted with this PR? If so, have the needed redirects been created?

  • Are all links in MDX files using the MDX link syntax rather than HTML link syntax?

    ref: MDX: [link](https://docs.amplify.aws/)
    HTML: <a href="https://docs.amplify.aws/">link</a>

When this PR is ready to merge, please check the box below

  • Ready to merge

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

Copy link
Member

@jjarvisp jjarvisp left a comment

Choose a reason for hiding this comment

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

Looking pretty good... will take a closer look later. Just that one suggestion for now.

Comment on lines 1147 to 1148
username: state.username,
password: state.password,
Copy link
Contributor

Choose a reason for hiding this comment

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

can we use placeholder strings for these?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Do you mean a variable with a placeholder string or string literals with a consistent placeholder string?

Copy link
Contributor

Choose a reason for hiding this comment

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


```ts
const { nextStep } = await signIn({
username: state.username,
Copy link
Member

Choose a reason for hiding this comment

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

Indentation is off here.

Copy link
Member

Choose a reason for hiding this comment

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

Also, this info should be on the switching authentication flows page I believe.

authFlowType?: AuthFlowType;
clientMetadata?: ClientMetadata;
preferredChallenge?: AuthFactorType;
};
Copy link
Member

Choose a reason for hiding this comment

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

It might be confusing to have types here that aren't referenced in the examples; the connection between these types and how to pass as options is unclear. Is there a way we can clarify this? Maybe using the SignInInput interface which is publicly exposed by the library... or just relying on the examples?

},
});

// nextStep.signInStep === 'DONE'
Copy link
Member

Choose a reason for hiding this comment

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

nextStep may not be DONE in all cases. We should provide a partial implementation of the handleNextSignInStep() handler

});

// nextStep.signInStep === 'CONTINUE_SIGN_IN_WITH_FIRST_FACTOR_SELECTION'
handleNextSignInStep(nextStep);
Copy link
Member

Choose a reason for hiding this comment

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

I think we should avoid including internal types in the documentation; we should show an example of how to use the availableChallenges instead.

});
```

### Sign In with a Preferred Challenge for First Factor
Copy link
Member

Choose a reason for hiding this comment

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

Also, be careful with headers, we created 3 new sections on this page. Should only be SMS OTP, Email OTP, WebAuthn Passkeys, and Password or SRP.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Are we restricted to those 3? I think giving details on the new USER_AUTH flow is a necessary prerequisite to handle the new passwordless methods.

Copy link
Member

Choose a reason for hiding this comment

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

We want to be consistent with the other libraries. We'd provide conceptual introduction to the auth flow on the Switching Authentication Flows page.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sounds good, I'll move it there - that section seems like a logical place for it to live in our doc structure (though I would still prefer it together 🙃)

Copy link
Member

@jjarvisp jjarvisp Nov 26, 2024

Choose a reason for hiding this comment

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

A good compromise might be to add a <Callout /> mentioning USER_AUTH with a link to that page

@josefaidt josefaidt merged commit 91241f7 into add-passwordless Nov 26, 2024
2 checks passed
@josefaidt josefaidt deleted the add-passwordless-js branch November 26, 2024 21:28
josefaidt added a commit that referenced this pull request Nov 26, 2024
* initial ia

* concept boilerplate

* add code snippet placeholders, cross links, warning for backend support

* chore(auth): add swift passwordless sign up/auto sign in changes (#8128)

* Apply suggestions from code review

* rm comments, stale sections

* chore: add new steps and new flow type

* chore(auth): add swift passwordless sign in/web authn changes (#8131)

* chore(auth): add swift passwordless sign in/web authn changes

* removed unused section

* remove flutter blocks

* fix spelling

* chore(auth): update swift passwordless autosignin Combine snippets (#8132)

* chore(auth): add js passwordless changes (#8129)

* chore(auth): add js passwordless changes

* chore(auth): add filters and a react-native callout; code spacing

* chore(auth): add sign in updates

* Update src/pages/[platform]/build-a-backend/auth/manage-users/manage-webauthn-credentials/index.mdx

Co-authored-by: James Jarvis <[email protected]>

* chore(auth): add associate api to the manage webauthn page

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

Co-authored-by: josef <[email protected]>

* chore(auth): use string literals

* chore(auth): add signin next step types

* add js sign up examples

* chore(auth): improve wording

* chore(auth): add first factor selection to confirm sign-in next steps

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

Co-authored-by: James Jarvis <[email protected]>

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

Co-authored-by: James Jarvis <[email protected]>

* chore(auth): review feedback - formatting and wording

* chore(auth): move user auth flow info into switching flows page

---------

Co-authored-by: James Jarvis <[email protected]>
Co-authored-by: josef <[email protected]>

* resolve structural issues

* fix extra closing tag

* filter passwordless blocks

* Update src/pages/[platform]/build-a-backend/auth/concepts/passwordless/index.mdx

* revert auth flow order change

* update user auth flow description

---------

Co-authored-by: Abhash Kumar Singh <[email protected]>
Co-authored-by: Harsh <[email protected]>
Co-authored-by: Parker Scanlon <[email protected]>
Co-authored-by: James Jarvis <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants