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

signInWithPopup With Multi-Tenancy #8617

Open
aress31 opened this issue Oct 29, 2024 · 1 comment
Open

signInWithPopup With Multi-Tenancy #8617

aress31 opened this issue Oct 29, 2024 · 1 comment

Comments

@aress31
Copy link

aress31 commented Oct 29, 2024

Operating System

Windows 11 Pro

Environment (if applicable)

Microsoft Edge, React

Firebase SDK Version

11.0.1

Firebase SDK Product(s)

Auth

Project Tooling

React app with MUI.

Detailed Problem Description

It appears that obtaining the email address from signInWithPopup prior to authentication is not feasible. This limitation necessitates a cumbersome workflow where users must first enter their email address in a field, which then allows for the correct tenant to be set in auth.tenant. This setup can lead to a frustrating user experience, as it introduces unnecessary steps. Please refer to the Proof of Concept (PoC) for further details.

Steps and code to reproduce issue

const handleGoogle = async () => {
  auth.useDeviceLanguage();

  try {
    // The auth need to be assigned the proper tenantId or this would fail, however, we can only fetch the tenant Id once the user has picked his preferred account...
    const userCredential = await signInWithPopup(
      auth,
      new GoogleAuthProvider()
    );
    const { isNewUser } = getAdditionalUserInfo(userCredential);

    if (isNewUser) {
      await auth.currentUser.delete();
      throw new Error(`${email} is not registered.`);
    } else {
        --- SNIP ---
    }
  } catch (error) {
    --- SNIP ----
  }
};
@aress31 aress31 added new A new issue that hasn't be categoirzed as question, bug or feature request question labels Oct 29, 2024
@google-oss-bot
Copy link
Contributor

I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.

@jbalidiong jbalidiong added api: auth needs-attention and removed needs-triage new A new issue that hasn't be categoirzed as question, bug or feature request labels Oct 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants