簡體   English   中英

我無法使用 Firebase 身份驗證使用電子郵件和密碼登錄

[英]I can't login with Email & Password using Firebase Authentication

我遇到了問題,當我嘗試通過 Firebase 身份驗證使用電子郵件/密碼登錄時。 我已經在登錄方法選項卡中啟用了電子郵件/密碼。 但是每當我在同一個應用程序中注冊時,它就會允許我將記錄插入到 Firebase 控制台用戶列表中,但是當我嘗試使用注冊的電子郵件和密碼登錄時,我無法繼續,並且異常消息是:

密碼無效或用戶沒有密碼。

對於登錄,我的代碼是:

FirebaseAuth auth=FirebaseAuth.getInstance();

auth.signInWithEmailAndPassword(email, password)
                        .addOnCompleteListener(LoginActivity.this, new OnCompleteListener<AuthResult>() {
                            @Override
                            public void onComplete(@NonNull Task<AuthResult> task) {
                                pb.dismiss();
                                if (task.isSuccessful()) {
                                    // Sign in success, update UI with the signed-in user's information
                                    Intent intent = new Intent(LoginActivity.this, DrawerActivity.class);
                                    startActivity(intent);
                                    finish();
                                } else {
                                    // If sign in fails, display a message to the user.
                                    //   Log.w("Tag", "Tag signInWithEmail:failure", task.getException());
                                    Log.i("Tags", "Tags signInWithEmail:failure" + task.getException());
                                    Toast.makeText(LoginActivity.this, "Authentication failed.",
                                            Toast.LENGTH_SHORT).show();

                                }


                            }
                        });

例如,這可能是當用戶 SomeUser 使用電子郵件 some_user@gmail.com 和任何密碼注冊時。 然后他使用同一電子郵件的谷歌帳戶登錄,然后嘗試使用他的谷歌帳戶的電子郵件再次登錄。 在這種情況下,谷歌會在用戶將他的 firebase 帳戶鏈接到谷歌帳戶后刪除密碼。 這里有一些細節

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM