Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possible bug on phone auth #216

Open
betocantu93 opened this issue May 10, 2022 · 5 comments
Open

Possible bug on phone auth #216

betocantu93 opened this issue May 10, 2022 · 5 comments

Comments

@betocantu93
Copy link

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...

if let errCode = AuthErrorCode(rawValue: error._code) {

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
Copy link
Author

It seems there was a breaking change

firebase/firebase-ios-sdk#7723

@Darrow8
Copy link

Darrow8 commented May 11, 2022

+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.

@betocantu93
Copy link
Author

betocantu93 commented May 11, 2022

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

@Darrow8
Copy link

Darrow8 commented May 12, 2022

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

@galaxyblur
Copy link

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants