我已成功部署了https://firebase.google.com/docs/auth/android/facebook-login中的教程代码,以便将Firebase身份验证登录与Facebook集成.用户已在Firebase Auth控制台中成功创建.
但是,我注意到用户对象中的电子邮件字段为空( - ).奇怪的是,我使用获取的令牌使用GraphRequest直接从提供者结果对象中成功检索了电子邮件信息.
根据我阅读的文档(https://firebase.google.com/docs/reference/android/com/google/firebase/auth/FirebaseUser.html#getEmail()),应从登录提供商填充电子邮件字段.
一些额外的奇怪行为:
有什么我想念或做的我做错了吗?
这是我的代码:
public class LoginActivity extends AppCompatActivity {
private static final String TAG = "LOGIN_ACTIVITY";
private static final int RC_SIGN_IN = 777;
private EventBus eventBus;
private SweetAlertDialog pDialog;
private FirebaseAuth mAuth;
private FirebaseAuth.AuthStateListener mAuthListener;
private CallbackManager mCallbackManager;
private ImageView mPasswordVisibilityView;
private TextView txtPassword;
private boolean justEnteredAuthStateChanged = false;
private GoogleApiClient mGoogleApiClient;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
FacebookSdk.sdkInitialize(getApplicationContext());
setContentView(R.layout.login);
// Firebase
mAuth = FirebaseAuth.getInstance();
mAuthListener …Run Code Online (Sandbox Code Playgroud) android facebook-authentication firebase firebase-authentication