Skip to content

feat: initial implementation for setting up fetchsigninwithemail behaviour#1343

Draft
russellwheatley wants to merge 11 commits intomainfrom
fetchsigninwithemail
Draft

feat: initial implementation for setting up fetchsigninwithemail behaviour#1343
russellwheatley wants to merge 11 commits intomainfrom
fetchsigninwithemail

Conversation

@russellwheatley
Copy link
Member

No description provided.

@gemini-code-assist
Copy link

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request introduces a robust mechanism for handling authentication errors where a user attempts to sign in with a different provider than previously used for the same email. It provides a new behavior that fetches and presents alternative sign-in methods, along with corresponding UI components for React and Angular, to guide users through the recovery process. This significantly improves the user experience by preventing dead ends during sign-in and offering clear paths to resolve credential conflicts.

Highlights

  • New Legacy Sign-In Recovery Behavior: Introduced a new legacyFetchSignInWithEmail behavior in @firebase-oss/ui-core to augment OAuth auth/account-exists-with-different-credential flows. This behavior fetches and stores available sign-in methods for a user's email, enabling recovery from mismatched credentials.
  • Cross-Platform UI Components for Recovery: Added dedicated UI components (LegacySignInRecoveryComponent for Angular and LegacySignInRecovery for React) to automatically render the recovery state as a modal on SignInAuthScreen and OAuthScreen. These components guide users to sign in with their previously used method.
  • Granular UI Control: Provided showLegacySignInRecovery props for SignInAuthScreen and OAuthScreen in both React and Angular, allowing developers to hide the built-in recovery UI and implement custom recovery flows using new hooks/injectors (useLegacySignInRecovery for React, injectLegacySignInRecovery/injectClearLegacySignInRecovery for Angular).
  • Enhanced Error Handling: Modified the core error handling logic to clear legacy sign-in recovery state and attach email information to errors, improving the context provided during authentication failures.
  • Documentation and Examples: Updated the README.md with comprehensive documentation for the new legacyFetchSignInWithEmail behavior and its associated UI components and hooks. A new demo screen was added to the React example application to showcase the recovery flow.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

</p>
</div>
<div className="fui-screen__children">
{hasMethod(recovery.signInMethods, "google.com") ? (

Check failure

Code scanning / CodeQL

Incomplete URL substring sanitization High

'
google.com
' can be anywhere in the URL, and arbitrary hosts may come before or after it.
{hasMethod(recovery.signInMethods, "google.com") ? (
<GoogleSignInButton onSignIn={handleRecoverySignIn} />
) : null}
{hasMethod(recovery.signInMethods, "github.com") ? (

Check failure

Code scanning / CodeQL

Incomplete URL substring sanitization High

'
github.com
' can be anywhere in the URL, and arbitrary hosts may come before or after it.
{hasMethod(recovery.signInMethods, "github.com") ? (
<GitHubSignInButton onSignIn={handleRecoverySignIn} />
) : null}
{hasMethod(recovery.signInMethods, "facebook.com") ? (

Check failure

Code scanning / CodeQL

Incomplete URL substring sanitization High

'
facebook.com
' can be anywhere in the URL, and arbitrary hosts may come before or after it.
{hasMethod(recovery.signInMethods, "facebook.com") ? (
<FacebookSignInButton onSignIn={handleRecoverySignIn} />
) : null}
{hasMethod(recovery.signInMethods, "apple.com") ? <AppleSignInButton onSignIn={handleRecoverySignIn} /> : null}

Check failure

Code scanning / CodeQL

Incomplete URL substring sanitization High

'
apple.com
' can be anywhere in the URL, and arbitrary hosts may come before or after it.
<FacebookSignInButton onSignIn={handleRecoverySignIn} />
) : null}
{hasMethod(recovery.signInMethods, "apple.com") ? <AppleSignInButton onSignIn={handleRecoverySignIn} /> : null}
{hasMethod(recovery.signInMethods, "microsoft.com") ? (

Check failure

Code scanning / CodeQL

Incomplete URL substring sanitization High

'
microsoft.com
' can be anywhere in the URL, and arbitrary hosts may come before or after it.
{hasMethod(recovery.signInMethods, "microsoft.com") ? (
<MicrosoftSignInButton onSignIn={handleRecoverySignIn} />
) : null}
{hasMethod(recovery.signInMethods, "twitter.com") ? (

Check failure

Code scanning / CodeQL

Incomplete URL substring sanitization High

'
twitter.com
' can be anywhere in the URL, and arbitrary hosts may come before or after it.
{hasMethod(recovery.signInMethods, "twitter.com") ? (
<TwitterSignInButton onSignIn={handleRecoverySignIn} />
) : null}
{hasMethod(recovery.signInMethods, "yahoo.com") ? <YahooSignInButton onSignIn={handleRecoverySignIn} /> : null}

Check failure

Code scanning / CodeQL

Incomplete URL substring sanitization High

'
yahoo.com
' can be anywhere in the URL, and arbitrary hosts may come before or after it.
@gemini-code-assist
Copy link

Warning

Gemini encountered an error creating the review. You can try again by commenting /gemini review.

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.

1 participant