Started working with Firebase. I wrote the registration, everything works. I am writing an authorization, the code seems to be correct, but when I click to login, nothing happens. What could be the problem ?

public void signin(String email, String password){ FirebaseAuth auth = FirebaseAuth.getInstance(); if(auth.getCurrentUser() != null) { //Уже подписан, ничего не делать } else { auth.signInWithEmailAndPassword(email,password).addOnCompleteListener(new OnCompleteListener<AuthResult>() { @Override public void onComplete(@NonNull Task<AuthResult> task) { if(task.isSuccessful()){ //Пользователь успешно подписан Toast.makeText(EmailPasswordActivity.this,"Welcome!",Toast.LENGTH_SHORT).show(); } } }); } } 

Gradle:

 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' implementation 'com.android.support:support-media-compat:28.0.0' 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.4' implementation 'com.google.firebase:firebase-database:16.0.4' implementation 'com.google.firebase:firebase-auth:16.0.4' 
  • one
    Probably you have some kind of error during authorization. And since no else to if(task.isSuccessful()) then nothing happens with this error. Add an else and log everything that is inside the Task<AuthResult> task - there will be an explanation of what Task<AuthResult> task error you had. - Yuriy SPb
  • @YuriSPb can tell me what should I write in else? - Famous
  • Well, for example, task.getException().printStacktrace() - YuriiSPb

0