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.

Improve login pop-up experience

See original GitHub issue

Bug, feature request, or proposal:

This is a proposal to improve the login popup experience as described below. Could be considered a bug fix.

What is the expected behavior?

When logging into MachineLabs, a single 0auth provider popup should show up. Right now it’s always two due to the reasons described below.

What is the current behavior?

Notice how two pop-ups appear when logging into ML:

may-07-2018 09-25-55

The reason this is happening, is because we first try to link the current user with the (newly created) auth user and only if that operation fails (the auth user for the given oauth provider already exists), we fall back to performing just a login. Between those operations we also create a new node for /users if needed.

Unfortunately, Firebase doesn’t provide an API that checks whether an auth user already exists or not. That’s why we always try to link the current (possibly anonymous) user first and only if that fails, we know the user already exists so we can simply login. If we’d try to login right away without trying to link the auth user first, the login will always fail as no auth user exists, which means no user will be able to login to MachineLabs.

The consequence of this is that we perform two operations for the login, resulting in two pop-ups (That’s also why for the very first login every made [where the auth user creation is successful], there’s only a single popup, because users are then automatically signed in).

What are the steps to reproduce?

If you have an ML account, login.

What is the use-case or motivation for changing an existing behavior?

This is obviously not a show stopper but definitely something we’d like to iron out at some point.

Is there anything else we should know?

I talked to other firebase devs to figure out how they handle such a scenario, especially because it’s so common. It turns out it’s the job of the developer to figure out how to handle this. One common approach is to create a dedicated users node, where created auth users are being added to. Then, when logging in, one would first perform a request to check whether that user exists in /users and then decide whether to perform linkWithPopup() or signInWithPopup() right away.

We already have this /users node, but we’d still need to figure out for what users to check against. Obviously, that’d be for example the github provider data email address, but that one we’re getting from the first popup that we’re trying to get rid off. Happy to discuss ideas here.

Here’s the code affected by this:

Basically the flow right now is like this:

-> login 
-> try to link current user with provider user (github)
-> fall back to just signing in, in case auth user is already link/authenticated
-> if user has been linked/authenticated for the first time, create new node in /users

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

0reactions
myspiveycommented, May 21, 2018

Woot!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Popup UX Design: Best Practices, Tips & Examples
In this post, we'll look at 5 popup UX design best practices that you can utilize to improve engagement and conversions on your...
Read more >
Everything You Need to Know About Creating Smooth ...
The best login experience might just be the one you don't notice much at all! · The elements of a login screen ·...
Read more >
Popups: 10 Problematic Trends and Alternatives
A popup (also known as an overlay or popover) is a window or dialog that ... get real insights to help you improve...
Read more >
How To Perfect Your Mobile App's Login Screen
Go for email instead of usernames; Facilitate password resetting; Keep users logged in. By following these best practices, you can start building an...
Read more >
11 Expert Tips For Enhancing The User Login Process
Improving the login experience comes down to making the entire process simple for the user. Granted, achieving this goal means more work for...
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