发生内部错误。 [ 无效 access_token,错误代码 43。]
An internal error has occured. [ invalid access_token, error code 43. ]
当我使用 Firebase 的 Facebook 凭据静默登录我的应用程序两次时,它 return 此错误消息。
An internal error has occured. [ invalid access_token, error code 43. ]
我在第一次登录时将 Facebook 令牌保存在 SharedPreferences 中,并在两次登录时获取它,然后使用 FacebookAuthProvider.getCredential(accessToken);
创建凭据。最后,我使用以下代码使用此凭据登录:
private void signInFirebase(AuthCredential credential, final TaskCompleteListener signInListener) {
FirebaseAuth.getInstance().signInWithCredential(credential)
.addOnCompleteListener(new OnCompleteListener<AuthResult>() {
@Override
public void onComplete(@NonNull Task<AuthResult> task) {
if (task.isSuccessful()) {
Logger.i(TAG,"Firebase login success.");
} else {
Logger.e(TAG,"Firebase login failure:"+task.getException().getMessage());
}
}
});
}
它总是像标题一样打印。
我已经尝试过,但没有用:
1.change Firebase version from 9.0.2 to 9.4.0
2.search error message in Google directly
如何解决这个问题?
Firebase 已在应用重启之间保留用户的登录状态。因此,与其自己保留 Facebook 令牌,不如 monitor whether the user is already authenticated with Firebase.
来自该文档:
FirebaseAuth.getInstance(). addAuthStateListener(new FirebaseAuth.AuthStateListener() {
@Override
public void onAuthStateChanged(@NonNull FirebaseAuth firebaseAuth) {
FirebaseUser user = firebaseAuth.getCurrentUser();
if (user != null) {
// User is signed in
Log.d(TAG, "onAuthStateChanged:signed_in:" + user.getUid());
} else {
// User is signed out
Log.d(TAG, "onAuthStateChanged:signed_out");
}
// ...
}
});
当我使用 Firebase 的 Facebook 凭据静默登录我的应用程序两次时,它 return 此错误消息。
An internal error has occured. [ invalid access_token, error code 43. ]
我在第一次登录时将 Facebook 令牌保存在 SharedPreferences 中,并在两次登录时获取它,然后使用 FacebookAuthProvider.getCredential(accessToken);
创建凭据。最后,我使用以下代码使用此凭据登录:
private void signInFirebase(AuthCredential credential, final TaskCompleteListener signInListener) {
FirebaseAuth.getInstance().signInWithCredential(credential)
.addOnCompleteListener(new OnCompleteListener<AuthResult>() {
@Override
public void onComplete(@NonNull Task<AuthResult> task) {
if (task.isSuccessful()) {
Logger.i(TAG,"Firebase login success.");
} else {
Logger.e(TAG,"Firebase login failure:"+task.getException().getMessage());
}
}
});
}
它总是像标题一样打印。 我已经尝试过,但没有用:
1.change Firebase version from 9.0.2 to 9.4.0
2.search error message in Google directly
如何解决这个问题?
Firebase 已在应用重启之间保留用户的登录状态。因此,与其自己保留 Facebook 令牌,不如 monitor whether the user is already authenticated with Firebase.
来自该文档:
FirebaseAuth.getInstance(). addAuthStateListener(new FirebaseAuth.AuthStateListener() {
@Override
public void onAuthStateChanged(@NonNull FirebaseAuth firebaseAuth) {
FirebaseUser user = firebaseAuth.getCurrentUser();
if (user != null) {
// User is signed in
Log.d(TAG, "onAuthStateChanged:signed_in:" + user.getUid());
} else {
// User is signed out
Log.d(TAG, "onAuthStateChanged:signed_out");
}
// ...
}
});