firebase / firebaseui-web

FirebaseUI is an open-source JavaScript library for Web that provides simple, customizable UI bindings on top of Firebase SDKs to eliminate boilerplate code and promote best practices.
https://firebase.google.com/
Apache License 2.0
4.58k stars 1.06k forks source link

Catch all errors from sign in - improvement for signInFailure #1074

Open Boardtale opened 7 months ago

Boardtale commented 7 months ago

Need:

I require for email + pwd to verify emails. As far as I know, I can't prevent or redirect flow after user first time creates account. So the error is sent from my blocking function: 'please verify email'. That does not look good when user tries to log in with unverfied email: image I want to catch that error and show proper error popup for the users.

I am using 'signInFailure' but it's not triggered.. I think ever :P I don't know where it's triggered but not if I get any forbidden from my blocking function

So I'd like to solve it somehow. I see few paths but neither is possible - afaik - with firebaseUI. Unless I'm gonna dirty trick it and break encapsulation.

  1. Stop auto sign in after creation of the account for email. I could redirect user in such case to dedicated page where I ask him to verify account. Also I need to be able to send that email there! So it's important for me to get handler
  2. Ignore the flow, but be able to catch all errors. Some kind of generic catch for all that thing.

EDIT:

I guess I could do this manually on my own backend, after login, check if verified email and then redirect them also logging them out. But that's many additional actions

Thanush19 commented 7 months ago

i can fix this @Boardtale can i work on this??

jhuleatt commented 7 months ago

Hi @Boardtale, thanks for reporting this. I agree that signInFailure should trigger if account creation or sign-in is blocked by a blocking function. We'll mark this as a bug.

As a side note, would email link authentication be a better fit for your use case than email + password?

HartGit01 commented 6 months ago

What are your difficulties problem

On Thursday, March 7, 2024, Thanush19 @.***> wrote:

i can fix this @Boardtale https://github.com/Boardtale can i work on this??

— Reply to this email directly, view it on GitHub https://github.com/firebase/firebaseui-web/issues/1074#issuecomment-1982335568, or unsubscribe https://github.com/notifications/unsubscribe-auth/A2WGGN7R5I7VEESS6OKV6TLYW7VZDAVCNFSM6AAAAABED3R3ECVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSOBSGMZTKNJWHA . You are receiving this because you are subscribed to this thread.Message ID: @.***>

hungrydaddy commented 3 months ago

Glad that I can confirm that I am not the only one experiencing this. My case is really similar where I am blocking user creation in the beforeCreate blocking function, returning a custom error that I prepare to catch and handle on the frontend to display a user-friendly error. Unfortunately I am in the same boat here @Boardtale , there seems no way to catch this error anywhere.

The only potential approach for me now is to use firebase SDK to initiate sign in flow which then defeats the purpose of me using this library.

Edit: Sorry I did not mention this, but for me this happens when a user tries to sign up using a Social sign in (Google/Microsoft).