Skip to content

E/Volley: [2672] BasicNetwork.performRequest: Unexpected response code 400 for https://www.googleapis.com/identitytoolkit/v3/relyingparty/signupNewUser? #330

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

Closed
kisanzxy opened this issue Apr 2, 2019 · 13 comments

Comments

@kisanzxy
Copy link

kisanzxy commented Apr 2, 2019

[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: _3.2.1
  • Firebase Component: _Database Auth (Database, Firestore, Storage, Functions, etc)
  • Component version: ____Auth 16.1.0 _

[REQUIRED] Step 3: Describe the problem

E/Volley: [2672] BasicNetwork.performRequest: Unexpected response code 400 for https://www.googleapis.com/identitytoolkit/v3/relyingparty/signupNewUser?alt=proto&key=api-key

Error occurs when creating a new user

Steps to reproduce:

What happened? How can we make the problem occur?
testing on an Android device, but no error when using an emulator
This could be a description, log/console output, etc.

Relevant Code:

// TODO(you): code here to reproduce the problem
@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.

@samtstern
Copy link
Contributor

@kisanzxy does this happen every time you create a new user? What are the steps to reproduce this?

@kisanzxy
Copy link
Author

kisanzxy commented Apr 2, 2019

@samstern
This happens only on the Android phone. And yes, it happens every time I create a new user on the android device. However, it works fine on the emulator. I use the sample code to test on a device and it happened.

@samtstern
Copy link
Contributor

@kisanzxy can you please provide the code that causes this issue? And what is the phone model? What version of Google Play services (settings --> apps --> Google Play services) is running on the phone?

@kisanzxy
Copy link
Author

kisanzxy commented Apr 2, 2019

@samtstern
Google play services version 16.0.89

And for the code. Could I email you or invite you as a collaborator?

@samtstern
Copy link
Contributor

@kisanzxy please just provide a small snippet of code here where the problem occurs, we can't look at or debug your whole project.

@kisanzxy
Copy link
Author

kisanzxy commented Apr 2, 2019

@samtstern This is where the bug might be; it always goes into the else branch and prints out
" CreateAccount Authentication failed." and the Firebase console didn't update
But we can create new user successfully everytime when testing on the emulator

And there is a snippet of the Gradle file

project level

    dependencies {
        classpath 'com.android.tools.build:gradle:3.3.2'
        classpath 'com.google.gms:google-services:4.0.1'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }

app level

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
    implementation 'com.android.support:support-v4:28.0.0'
    implementation 'com.google.firebase:firebase-core:16.0.7'
    implementation 'com.google.firebase:firebase-auth:16.2.0'
}
private void createAccount(String email, String password) {
        Log.d(TAG, "createAccount:" + email);
        if (!validateForm()) {
            return;
        }

        // [START create_user_with_email]
        mAuth.createUserWithEmailAndPassword(email, password)
                .addOnCompleteListener(getActivity(), new OnCompleteListener<AuthResult>() {
                    @Override
                    public void onComplete(@NonNull Task<AuthResult> task) {
                        if (task.isSuccessful()) {
                            // Sign in success, update UI with the signed-in user's information
                            Log.d(TAG, "createUserWithEmail:success");

                            Toast.makeText(getActivity(), "CreateAccount Success.",
                                    Toast.LENGTH_SHORT).show();
                            FirebaseUser user = mAuth.getCurrentUser();

                        } else {
                            // If sign in fails, display a message to the user.
                            Log.w(TAG, "createUserWithEmail:failure", task.getException());
                            Toast.makeText(getActivity(), "CreateAccount Authentication failed.",
                                    Toast.LENGTH_SHORT).show();

                        }

                    }

                });
        // [END create_user_with_email]
    }

@samtstern
Copy link
Contributor

@malcolmdeck any idea what might cause a simple createUserWithEmailAndPassword to return a 400 error? The device has latest GmsCore (16.0.089) and the code works on an emulator, which is the opposite of the problem people normally have.

@malcolmdeck
Copy link
Contributor

malcolmdeck commented Apr 2, 2019 via email

@lsirac
Copy link

lsirac commented Apr 2, 2019

What exception is it failing with?

@kisanzxy
Copy link
Author

kisanzxy commented Apr 3, 2019

@samtstern
HI, I feel so sorry to report this bug. The only reason that we cannot create a new user is that when typing in the email, there is a single space added to the end. So the auth failed because of the bad format error after we look into the full error message. However, the error message only printed out half part " CreateAccount Authentication failed.". It's really hard to notice this tiny " " at the end of the email string.

@kisanzxy
Copy link
Author

kisanzxy commented Apr 3, 2019

This thread can be closed

@samtstern
Copy link
Contributor

@kisanzxy thanks for telling us!
@lsirac can we maybe have the backend trim some inputs?

@firebase firebase locked and limited conversation to collaborators Oct 11, 2019
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

5 participants