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

Auth error codes (at least) are locale-converted #2593

Closed
mikehardy opened this issue Apr 16, 2021 · 4 comments
Closed

Auth error codes (at least) are locale-converted #2593

mikehardy opened this issue Apr 16, 2021 · 4 comments

Comments

@mikehardy
Copy link

mikehardy commented Apr 16, 2021

[READ] Step 1: Are you in the right place?

Issues filed here should be about bugs in the code in this repository.
If you have a general question, need help debugging, or fall into some
other category use one of these other channels:

  • For general technical questions, post a question on StackOverflow
    with the firebase tag.
  • For general Firebase discussion, use the firebase-talk
    google group.
  • For help troubleshooting your application that does not fall under one
    of the above categories, reach out to the personalized
    Firebase support channel.

[REQUIRED] Step 2: Describe your environment

  • Android Studio version: 4.1.3 (current stable)
  • Firebase Component: Auth (at least, may be others?) (Database, Firestore, Storage, Functions, etc)
  • Component version: BoM 26.8.0

[REQUIRED] Step 3: Describe the problem

Steps to reproduce:

Switch your device locale to Turkish
Use an auth.signInWithEmailAndPassword but give it an invalid email
Check the error code - it will have the Turkish i-with-no-dots characters

This is problematic because you need to match multiple cases for the "same" error code (that differs only in the 'i' character)

Relevant Code:

Relevant downstream issue: invertase/react-native-firebase#3917

I think this is because the error code is being passed through a Locale sensitive method (like toLowerCase) while using the default locale instead of Locale.ROOT - I've had this problem before in Android code.

The messages might be localized but the codes should always be the same regardless of locale I think?

Not the most important thing but a quick grep of the auth code for Locale.getDefault() in context of error codes might turn it up quickly, and swapping that for Locale.ROOT might be one of the easier fixes ever, which is always satisfying.

Cheers

@google-oss-bot
Copy link
Contributor

I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.

@mikehardy mikehardy changed the title Auth error messages (at least) are locale-converted Auth error codes (at least) are locale-converted Apr 16, 2021
@malcolmdeck
Copy link
Contributor

Thanks for the report. I've filed b/185793543 to track this internally

@mikehardy
Copy link
Author

@malcolmdeck did you notice anything in your codebase that looked like this? I was enabling more lint rules in the react-native-firebase repo yesterday prepping to release the react-native bindings for the v28.x.x features here and I noticed that this might have been on our side?

invertase/react-native-firebase@bef04fc#diff-742544c6681aeb98a76076270ee96c33db2652bb2663b3a3f7c946b34be530aeL1888-R1889

I think this is probably closable here unless you've actually found something

Can always reopen if feedback from downstream users indicates it's still happening but I think I got it. Cheers!

@malcolmdeck
Copy link
Contributor

Glad you found what you thought it might be - I spend about an hour and a half looking around our codebase and didn't find anything, but I wasn't sure that I didn't miss it so I left this open. Thanks for tracking it down Mike :D

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

No branches or pull requests

4 participants