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 skipAssertUserNotAuthenticated option to signInWithRedirect #12584

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

dehli
Copy link

@dehli dehli commented Nov 17, 2023

Description of changes

This PR allows you to call signInWithRedirect even when a user is already signed in. The use-case is that we have Google login and some customers want to enforce that their users only sign-in with Google. If a user logs in with their password we will show an error along with a button prompting them to sign-in via Google. With v5, you could call Auth.federatedSignIn even when a user was already logged in. This allows you to similarly call signInWithRedirect.

I'm 50/50 on the name, might want to do the inverse so a truthy value would allow you to skip the assertion.
Edit: Decided to do the inverse instead.

Description of how you validated changes

Used patch-package with these changes.

Checklist

  • PR description included
  • yarn test passes
    • I'm getting 4 failures that are unrelated to my changes.
  • Tests are changed or added
    • Added placeholders for the time being since the function itself only has placeholders. Figured I'd submit the PR without them first.
  • Relevant documentation is changed or added (and PR referenced)
    • Is adding comments to interface all that's needed?

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

@dehli dehli requested a review from a team as a code owner November 17, 2023 11:57
@dehli dehli force-pushed the main branch 3 times, most recently from d8523d4 to 1350a3b Compare November 17, 2023 12:38
@dehli dehli changed the title add assertUserNotAuthenticated option to signInWithRedirect add skipAssertUserNotAuthenticated option to signInWithRedirect Nov 17, 2023
@cwomack
Copy link
Member

cwomack commented Feb 20, 2024

Hey, @dehli 👋. We appreciate you opening this PR and will review it internally and reach out if there's further questions or suggestions.

@cwomack cwomack added the Auth Related to Auth components/category label Feb 20, 2024
@cwomack
Copy link
Member

cwomack commented Aug 20, 2024

@dehli, can you provide more context as to why just enforcing Google as your only federated provider for sign-in would not work here? We're not fully understanding what the benefit here would be to allow for an additional call of signInWithRedirect when you already have a user signed in with valid credentials.

@dehli
Copy link
Author

dehli commented Aug 20, 2024

Hey @cwomack, for sure! The specific usecase is that you're logged in with your email/password but trying to access something that can only be accessed when logged in via Google.

We have a saas tool that allows you to login with email/password or Google. Some of our customers would like to require that their data is only accessible by users who have logged in with Google. We don't want to force all users to login with Google which is why we needed this functionality.

Let me know if that doesn't make sense or if you can think of a better workaround!

@cwomack cwomack added need-product-input Needs non-technical requirements or direction to proceed and removed pending-response labels Sep 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Auth Related to Auth components/category external-contributor need-product-input Needs non-technical requirements or direction to proceed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants