rithik-dev / firebase_phone_auth_handler

An easy-to-use firebase phone authentication package to easily send and verify OTP's with auto-fetch OTP support via SMS. Supports web out of the box.
https://pub.dev/packages/firebase_phone_auth_handler
MIT License
30 stars 33 forks source link

web compatibility #11

Open mufarrah opened 2 years ago

mufarrah commented 2 years ago

Hey , thanks alot for the package.

you have push the latest release for linking in the phone auth with current user details. so as far as I'm aware, this method is not working yet on web. have you yet been able to achieve this on web ??

rithik-dev commented 2 years ago

Hey @mufarrah, I could not find any way to get the auth credential from the web sign-in handler, and that is needed for linking user's credential.

There are no official docs also that I could find for the same. If you have some docs referring to this issue, please share so I'll implement accordingly..

As of now, it works only on mobile devices and not on the web platform..

esmlima commented 1 year ago

Hi @rithik-dev , I don't understand... Should this package work in a flutter web project or not? If not, what do you mean by "Supports OTP on web out of the box" in the readme?

image

mufarrah commented 1 year ago

Hi @rithik-dev , I don't understand... Should this package work in a flutter web project or not? If not, what do you mean by "Supports OTP on web out of the box" in the readme?

image

Is working on web as i tried it. but the problem is that when i already have users that are registered, and i tried to login using otp and multifactor, i could not link the logged in user with the user that was already registered in flutter web. i think that is the issue here

rithik-dev commented 1 year ago

Yep, @mufarrah answers the issue correctly. I was not able to find a way to link to an existing user on web, as there is a different API when using phone authentication on web.

And btw, "supports web out of the box" implies exactly this that the widget internally handles the different logics for authentication on mobile and web, and none of it needs to be handled by you 😀

@esmlima

esmlima commented 1 year ago

Thanks for your quick response @rithik-dev and @mufarrah . I'm still not able to make it work... In the project's example screens, you show an SMS with text that is very different from the default Firebase template. From everything I've read from the documentation, it's not possible to change the SMS text, how did you get that? Do you believe that the format of the message could be causing the package not to work for me?

Your SMS example: image

My SMS (initially with portuguese Firebase template and later with english template - none have worked): WhatsApp Image 2022-12-20 at 18 15 34

rithik-dev commented 1 year ago

Hey @esmlima , that screenshot is quite old I am guessing, that is why the template seems different.

I've also tried to change the template and didn't find any way to change that...

rithik-dev commented 1 year ago

I don't think the template plays any role in your code not working. I would say go through the README once again to see if you missed some configuration steps...

esmlima commented 1 year ago

Hi @rithik-dev , thanks for your response. I've read and re-read your README several times. I've tested numerous approaches on 3 different projects and I can't get it to work. I'm able to send the messages and manually authenticate the user, but the autofill just doesn't work. I sent you an email and a Linkedin connection, would you consider an offer for freelance work?

esmlima commented 1 year ago

There is an open issue regarding Firebase SMS template not working in web: https://github.com/firebase/firebaseui-web/issues/828

It does not comply with the web.dev standard for OTP: https://web.dev/web-otp/

I'm able to make autofill work in web using the standard SMS message template and their demo page: https://web-otp.glitch.me/

But if I change the template (even slightly) the autocomplete stops working. And the default Firebase SMS template simply doesn't comply to that standard. image

rithik-dev commented 1 year ago

Oh, so I think you can stick to the default template for now. This package is just a wrapper around the base firebase package, so, whenever that is fixed, so, this package will reflect the fixes.. (I keep updating the dependencies time to time)