我正在使用firebase facebook登录我的应用程序当用户首次登录Facebook时创建帐户并让用户登录但是在用户退出后或者如果我删除应用程序数据并再次登录则会出现错误日志。
fbauth = FirebaseAuth.getInstance();
final LoginButton loginButton = (LoginButton) findViewById(R.id.fbsignup_button);
loginButton.setReadPermissions("email","public_profile");
mAuthListener = new FirebaseAuth.AuthStateListener() {
@Override
public void onAuthStateChanged(@NonNull FirebaseAuth firebaseAuth) {
FirebaseUser user = firebaseAuth.getCurrentUser();
if (user != null) {
Intent intent = new Intent(SignupActivity.this, BaseActivity.class);
startActivity(intent);
// User is signed in
Log.d("", "onAuthStateChanged:signed_in:" + user.getUid());
} else {
// User is signed out
Log.d("", "onAuthStateChanged:signed_out");
}
}
};
loginButton.registerCallback(mCallbackManager, new FacebookCallback<LoginResult>() {
@Override
public void onSuccess(LoginResult loginResult) {
Log.d("FacebookAuthresult", "facebook:onSuccess:" + loginResult);
handleFacebookAccessToken(loginResult.getAccessToken());
}
@Override
public void onCancel() {
Log.d("FacebookAuthresult", "facebook:onCancel");
// ...
}
@Override
public void onError(FacebookException error) {
Log.d("FacebookAuthresult", "facebook:onError", error);
// ...
}
});
private void handleFacebookAccessToken(AccessToken token) {
Log.d("FacebookAuthresult", "handleFacebookAccessToken:" + token);
AuthCredential credential = FacebookAuthProvider.getCredential(token.getToken());
fbauth.signInWithCredential(credential)
.addOnCompleteListener(this, new OnCompleteListener<AuthResult>() {
@Override
public void onComplete(@NonNull Task<AuthResult> task) {
Log.d("FacebookAuthresult", "signInWithCredential:onComplete:" + task.isSuccessful());
if (task.isSuccessful()) {
FirebaseUser user = FirebaseAuth.getInstance().getCurrentUser();
appsettings appData = new appsettings();
if(user.getEmail()!= null)
appData.setEmailofuser(user.getEmail());
if(user.getDisplayName() != null)
appData.setUsername(user.getDisplayName());
if(user.getPhotoUrl() != null) {
appData.setUriofphoto(user.getPhotoUrl());
Log.v("FBReturnedphoto", user.getPhotoUrl().toString());
appData.savePreference(getApplicationContext());
}
Intent intent = new Intent(SignupActivity.this, BaseActivity.class);
startActivity(intent);
}
else {
Log.w("FacebookAuthresult", "signInWithCredential", task.getException());
Toast.makeText(SignupActivity.this, "Authentication failed.",
Toast.LENGTH_SHORT).show();
}
// ...
}
});
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
mCallbackManager.onActivityResult(requestCode, resultCode, data);
}
如果我从firebase控制台删除用户信息并从Facebook应用程序设置中删除应用程序,它仅在第一次再次正常工作,并且在签署用户之后再次出现同样的问题。&#34;
错误日志:
08-25 21:07:52.021 19950-19950/android.housekeeping2 D/FacebookAuthresult: facebook:onError
Login Error: There is an error in logging you into this application. Please try again later.
at com.facebook.login.LoginManager.onActivityResult(LoginManager.java:173)
at com.facebook.login.LoginManager$1.onActivityResult(LoginManager.java:139)
at com.facebook.internal.CallbackManagerImpl.onActivityResult(CallbackManagerImpl.java:82)
at android.housekeeping2.Authentication.SignupActivity.onActivityResult(SignupActivity.java:304)
at android.app.Activity.dispatchActivityResult(Activity.java:6456)
at android.app.ActivityThread.deliverResults(ActivityThread.java:3695)
at android.app.ActivityThread.handleSendResult(ActivityThread.java:3742)
at android.app.ActivityThread.-wrap16(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1393)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
at de.robv.android.xposed.XposedBridge.main(XposedBridge.java:102)
08-25 21:07:52.021 19950-19950/android.housekeeping2 D/FirebaseApp: Notifying background state change listeners.
08-25 21:07:52.021 19950-19995/android.housekeeping2 V/FA: Activity resumed, time: 201706171
答案 0 :(得分:2)
这是Facebook工具&amp;支持团队并得到确认。您现在可以在this link.
上查看错误的状态您还可以在下面看到Stack Overflow问题:
Login Error: There is an error in logging you into this application. Please try again later