capacitor-firebase-auth icon indicating copy to clipboard operation
capacitor-firebase-auth copied to clipboard

Possible bug on phone auth

Open betocantu93 opened this issue 2 years ago • 5 comments

Hello, thanks for the amazing work.

Suddenly my app stopped building, not sure if one of my deps updated or something. But suddenly this line stopped working...

https://github.com/baumblatt/capacitor-firebase-auth/blob/7a62d887e0189b2d4196d7dc519c14635e6deaae/ios/Plugin/Handlers/PhoneNumberProvider.swift#L34 Screen Shot 2022-05-09 at 23 59 26

I "patched it" like this, not sure if its the right approach?

Screen Shot 2022-05-09 at 23 59 43

Thnaks

betocantu93 avatar May 10 '22 05:05 betocantu93

It seems there was a breaking change

https://github.com/firebase/firebase-ios-sdk/issues/7723

betocantu93 avatar May 10 '22 12:05 betocantu93

+1

I had this same issue, and eventually just did this:

if let error = error {
                 let errCode = AuthErrorCode(AuthErrorCode.Code(rawValue: error._code) ?? AuthErrorCode.internalError)
                    switch errCode {
                    case AuthErrorCode.quotaExceeded:
                        call.reject("Quota exceeded.")
                    case AuthErrorCode.invalidPhoneNumber:
                        call.reject("Invalid phone number.")
                    case AuthErrorCode.captchaCheckFailed:
                        call.reject("Captcha Check Failed")
                    case AuthErrorCode.missingPhoneNumber:
                        call.reject("Missing phone number.")
                    default:
                        call.reject("PhoneAuth Sign In failure: \(String(describing: error))")
                    }

                    return
            }

The issue looks to be related to how this library handles errors, and the authcodes that used to exist on firebase auth have changed.

Hopefully the maintainers of this library release an update to address this breaking change.

Darrow8 avatar May 11 '22 00:05 Darrow8

Yea, firebase update had a breaking change.

One question @Darrow8 , how do you override this code? Do you published another package to npm? Or how do you make sure other devs on your team get these changes?

I'm not a native dev so I struggled, forked and published a new package

https://github.com/betocantu93/capacitor-firebase-auth/tree/release-npm

published as bengala-capacitor-firebase-auth

betocantu93 avatar May 11 '22 02:05 betocantu93

@betocantu93 oh okay cool, I did not publish a new package, I just directly edited the library code for my local version.

Darrow8 avatar May 12 '22 01:05 Darrow8

@Darrow8 your fix worked for me, thanks. (I don't even use Phone auth and this error was blocking me.)

I think the maintainer, @baumblatt , needs some help or funding. I would absolutely contribute in whatever way possible. I am also not a native dev, but happy to contribute some money or JS code. @baumblatt please let us know what we can do to keep this library alive! Thanks for the work you've done so far.

galaxyblur avatar Jun 07 '22 12:06 galaxyblur