4

I'm making an app that needs the user to authenticate with Google, but it has to be done using email/password and the logged in account must not be added to the device account list.

Login is an easy thing to do with Google SignIn but it doesn't meet my requirements.

I've searched similar questions but it seems there was no solution at the time, here and here

Maybe now with the new versions of GoogleSignInClient or something similar is there a way to achieve this? I just need to check email and password are correct.Thanks in advance.

frlv73
  • 41
  • 3

1 Answers1

0

you can create an account without adding the account in your device you have to create 2 edit text and just enter that email-id and password on these fileds and pass in a method just like that:-

FirebaseAuth mAuth = FirebaseAuth.getInstance();
createAccount(registerEmail.getText().toString(), registerPassword.getText().toString());

and create a method:-

private void createAccount(String email, String password) {
        mAuth.createUserWithEmailAndPassword(email, password)
                .addOnCompleteListener(this, new OnCompleteListener<AuthResult>() {
                    @Override
                    public void onComplete(@NonNull Task<AuthResult> task) {
                        pd.dismiss();
                        if (task.isSuccessful()) {
                          Toast.makeText(MainActivity.this, "You are registered successfully", Toast.LENGTH_SHORT).show();
                        } else {
                            Toast.makeText(MainActivity.this, task.getException().getMessage(),
                                    Toast.LENGTH_SHORT).show();
                        }
                    }
                });
    }
Sandeep Malik
  • 1,972
  • 1
  • 8
  • 17