question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Feature Request] Support a pre-filled email address

See original GitHub issue

Is your feature request related to a problem? Please describe.

In my landing page, I have a simple form where people can enter their email address and sign up. I want to take them to a separate page to complete the sign up using firebaseui. As a result, I need a way to pre-fill the email address for the EmailAuthProvider.

FYI, other users may go directly to my sign up page and will enter the email address manually.

Describe the solution you’d like

An additional option in signInOptions that allows me to specify an email address.

Describe alternatives you’ve considered

I currently solve this by setting the value of the “email” input in the uiShown callback. This works ok, but feels brittle as it relies on the name of the form field remaining constant over time.

It also has a visual problem if the user removes focus from the email field without editing it. In that case, the label will drop down and obscure the text (presumably because the input doesn’t consider it has been dirtied?).

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:8
  • Comments:8 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
aheimlichcommented, Dec 16, 2020

The solution only works if you use email as the only sign-in option. If you provide multiple options, the approach doesn’t work as the email field is not available when uiShown is called.

People using multiple sign-in options can use this:

      uiShown: () => {
        const container = document.getElementsByClassName(
          "login-button-container"
        )[0];
        // Options for the observer (which mutations to observe)
        const config = { childList: true, subtree: true };

        // Callback function to execute when mutations are observed
        const callback = () => {
          const emailInput = container.querySelector("#ui-sign-in-email-input");

          if (emailInput) {
            emailInput.value = 'user@email.com';
            emailInput.readOnly = true;
          }
        };

        // Create an observer instance linked to the callback function
        const observer = new MutationObserver(callback);

        // Start observing the target node for configured mutations
        observer.observe(container, config);
      },

I found a uiChanged callback, but it’s not documented anywhere. So, I’d be hesitant to use it.

There’s also firebaseui.auth.AuthUI.prototype.startWithSignInHint, but that’s not publically exposed right now (are there any plans for this?)

2reactions
xil222commented, Aug 31, 2021

@arickuter sorry, not yet. I’ll look onto this when I get time.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Feature request response email templates - LiveAgent
Feature requests are messages that customers send to inquire about a feature that is not included in your product or service.
Read more >
Prefilled Form > Add the Reminder Email option in ... - Jotform
Hi Jotform, Is it possible to send a client a notification email to complete an incomplete form (automatically)?
Read more >
Manage suggested recipients in the To, Cc, and Bcc boxes ...
Exchange Online on Microsoft 365 provides some search features via Microsoft Search. This includes suggested recipients when composing a new email.
Read more >
Is it possible to pre-populate email field in the widget?
There is a feature request suggesting the implementation of this ability: Prefill email field in Service Desk widget.
Read more >
Creating pre-filled ticket forms - Zendesk help
Copy the URL for the ticket form that end users see when they click Submit a request and paste it into a text...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found