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

[firebase_auth] errors codes are incorrect #3921

Closed
ollyde opened this issue Oct 20, 2020 · 8 comments
Closed

[firebase_auth] errors codes are incorrect #3921

ollyde opened this issue Oct 20, 2020 · 8 comments
Labels
plugin: auth type: bug Something isn't working

Comments

@ollyde
Copy link

ollyde commented Oct 20, 2020

Previously we had error codes working correctly on signup/login. Now the errors codes thrown are different. We didn't know until users were complaining about it.

When was this deprecated? And why wasn't it done correctly?

Example of previous error pickup =

if (e is PlatformException) {
      if (e.code == 'ERROR_EMAIL_ALREADY_IN_USE') {
           message = lang('error_email_already_in_use');
      }
      if (e.code == 'ERROR_WEAK_PASSWORD') {
           message = 'The password was weak, try another. Perhaps longer with more special characters.';
      }
      if (e.code == 'ERROR_INVALID_EMAIL') {
           message = lang('error_invalid_email_signup');
     }
}

Now the error codes throw look like this: firebase/EMAIL_ALREADY_IN_USE

@ollyde ollyde added Needs Attention This issue needs maintainer attention. type: bug Something isn't working labels Oct 20, 2020
@dackers86
Copy link
Member

HI @OllyDixon

Our documentation shows that your original code is correct (https://firebase.flutter.dev/docs/auth/usage/#emailpassword-registration--sign-in). Can you confirm which version of auth you are using.

We have templates for correctly tracking and issues https://github.com/FirebaseExtended/flutterfire/issues/new/choose.

Using this will support in finding the issue. Thanks!

@ollyde
Copy link
Author

ollyde commented Oct 20, 2020

I'm using firebase_auth: 0.18.0 the original no longer works. There is also another auth section with 12 switch cases, I had to change this one to this for now:

    if (e is FirebaseAuthException) {
      if (e.code == 'email-already-in-use') {
        message = lang('error_email_already_in_use');
      }
      if (e.code == 'invalid-email') {
        message = lang('error_invalid_email_signup');
      }
      if (e.code == 'weak-password') {
        message = 'The password was weak, try another. Perhaps longer with special characters.';
      }
    }

@ollyde
Copy link
Author

ollyde commented Oct 20, 2020

@dackers86 this is a diaster I imagine so many apps using Firebase auth will have silient errors now. This wasn't deprecated with any warnings; previosuly we were told what the values were; now we don't know.

Screenshot 2020-10-20 at 14 41 16

@markusaksli-nc
Copy link
Contributor

Printing FirebaseAuthException.code using firebase_auth: ^0.18.1+2 outputs:

I/flutter ( 4998): email-already-in-use

Can't find anything in the changelog regarding this being changed, aside from 0.18.0:

Added a new FirebaseAuthException class (extends FirebaseException)

@markusaksli-nc markusaksli-nc added plugin: auth and removed Needs Attention This issue needs maintainer attention. labels Oct 20, 2020
@Salakar
Copy link
Member

Salakar commented Oct 20, 2020

@dackers86 could you send a PR up to add this to the changelog please? Ping me on slack if you need more info. Thanks

@ollyde
Copy link
Author

ollyde commented Oct 20, 2020

@markusaksli-nc @Salakar we've almost implemented a solution with the new codes (tested them all). Will this be changed again or not? (We really need enums tbh)

@Ehesp
Copy link
Member

Ehesp commented Oct 20, 2020

#3402 there is this PR up, some discussion in there

@Salakar
Copy link
Member

Salakar commented Jan 28, 2022

Closing in favour of #3273

@Salakar Salakar closed this as completed Jan 28, 2022
@firebase firebase locked and limited conversation to collaborators Feb 28, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
plugin: auth type: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants