Open
Description
[READ] Step 1: Are you in the right place?
Yes, right place.
[REQUIRED] Step 2: Describe your environment
- Android Studio version: 2022.3.1
- Firebase Component: Auth (Database, Firestore, Storage, Functions, etc)
- Component version: 22.3.1
[REQUIRED] Step 3: Describe the problem
language locale in auth blocking function is "und" which means undetermined. This is occuring even when setting the language code.
First reported on FlutterFire repo: firebase/flutterfire#12519
This is not an issue on firebas-ios-sdk.
Logcat shows why it is "und":
2024-04-03 09:50:57.889 26056-26147 System io.flutter.plugins.firebase.tests W Ignoring header X-Firebase-Locale because its value was null.
Steps to reproduce:
I have a repo with reproduction here: https://github.com/russellwheatley/firebase-android
Here are the steps taken from README:
- Update applicationId & namespace in app/build.gradle to your app in your firebase project.
- Update app/google-services.json to your firebase project.
- Run
npm i
in backend/functions directory followed bynpm run deploy
to deploy the cloud functions to your firebase project. - Run the app on an emulator and press the button in the bottom right hand corner to set the language, create a user and trigger the cloud function.
- Head to the cloud function logs and observe the locale as
authBeforeUserCreated {"locale":"und",....other properties}.
This should be "en-US".
Relevant Code:
FirebaseApp app = FirebaseApp.getInstance();
FirebaseAuth auth = FirebaseAuth.getInstance(app);
auth.setLanguageCode("en-US");
auth.createUserWithEmailAndPassword("[email protected]", "qwerty123").addOnCompleteListener(task -> {
if (task.isSuccessful()) {
Log.d(TAG, "User created successfully");
} else {
Log.d(TAG, "User creation failed");
}
});