![](/img/trans.png)
[英]Getting error "invalid_request: Invalid web redirect url" when using Apple ID sign-in with Firebase
[英]Firebase Sign-in with email after google sign-in has error : The password is invalid or the user does not have a password
我正在為我的 iOS 應用程序使用 Firebase 身份驗證服務。 我想使用 email 或谷歌登錄提供商登錄應用程序。 我應用了 firebase intractions 。
我可以使用 email 和密碼登錄。 然后我可以使用 Firebase 退出方法退出:
Auth.auth().signOut()
后來,我可以成功地與谷歌簽約和退出。 當我使用 email 和密碼重新驗證時,返回此消息:
密碼無效或用戶沒有密碼。
我無法使用 email 登錄。
在 Firebase 控制台上,用戶帳戶符號從郵件更改 去谷歌
. 因此,我只能與 Google 登錄提供商簽約,而不是 email。
我無法解決這個問題。 我的錯是什么? 下面是我的代碼部分。
此外,當我在 firebase 控制台上重置密碼時,我可以使用其中兩個登錄。 兩個圖像一起出現在控制台上: 我該如何解決這個麻煩?
謝謝!
在 AppDelegate.swift 中:
func sign(_ signIn: GIDSignIn!, didSignInFor user: GIDGoogleUser!, withError error: Error!) {
if let error = error {
log.debug("Error Google Sign-in: \(error)")
return
}
guard let authentication = user.authentication else { return }
let credential = GoogleAuthProvider.credential(withIDToken: authentication.idToken,
accessToken: authentication.accessToken)
Auth.auth().signInAndRetrieveData(with: credential) { (authResult, error) in
if let error = error {
log.error(error)
return
}
// User is signed in
}
}
這是注銷按鈕操作:
@IBAction func logout_TouchUpInside(_ sender: Any) {
do {
try Auth.auth().signOut()
GIDSignIn.sharedInstance().signOut()
} catch let error {
log.error(error.localizedDescription)
}
log.info("After logout current user: \(String(describing: Auth.auth().currentUser))")
}
這僅適用於未按照此處所述進行驗證的電子郵件和密碼帳戶:
https://github.com/firebase/firebaseui-web/issues/122#issuecomment-291528845
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.