'Firebase auth: problem with insert user on Google Sign-In in Android
I try to create auth with Firebase in my android project. after following the documentation, I can access user details like email or displayName but method signInWithCredential in firebase displays error.
code:
private fun firebaseAuthWithGoogle(acct: GoogleSignInAccount) {
val credential = GoogleAuthProvider.getCredential(acct.idToken, null)
auth.signInWithCredential(credential)
.addOnCompleteListener(this) { task ->
if (task.isSuccessful) {
val user = auth.currentUser
} else {
Log.w("LOG", "signInWithCredential:failure", task.exception)
}
}
}
error:
W/LOG: signInWithCredential:failure
com.google.firebase.FirebaseException: An internal error has occurred. [ <!DOCTYPE html>
<html lang=en>
<meta charset=utf-8>
<meta name=viewport content="initial-scale=1, minimum-scale=1, width=device-width">
<title>Error 403 (Forbidden)!!1</title>
<style>
*{margin:0;padding:0}html,code{font:15px/22px arial,sans-serif}html{background:#fff;color:#222;padding:15px}body{margin:7% auto 0;max-width:390px;min-height:180px;padding:30px 0 15px}* > body{background:url(//www.google.com/images/errors/robot.png) 100% 5px no-repeat;padding-right:205px}p{margin:11px 0 22px;overflow:hidden}ins{color:#777;text-decoration:none}a img{border:0}@media screen and (max-width:772px){body{background:none;margin-top:0;max-width:none;padding-right:0}}#logo{background:url(//www.google.com/images/branding/googlelogo/1x/googlelogo_color_150x54dp.png) no-repeat;margin-left:-5px}@media only screen and (min-resolution:192dpi){#logo{background:url(//www.google.com/images/branding/googlelogo/2x/googlelogo_color_150x54dp.png) no-repeat 0% 0%/100% 100%;-moz-border-image:url(//www.google.com/images/branding/googlelogo/2x/googlelogo_color_150x54dp.png) 0}}@media only screen and (-webkit-min-device-pixel-ratio:2){#logo{background:url(//www.google.com/images/branding/googlelogo/2x/googlelogo_color_150x54dp.png) no-repeat;-webkit-background-size:100% 100%}}#logo{display:inline-block;height:54px;width:150px}
</style>
<a href=//www.google.com/><span id=logo aria-label=Google></span></a>
<p><b>403.</b> <ins>That’s an error.</ins>
<p>Your client does not have permission to get URL <code>/identitytoolkit/v3/relyingparty/verifyAssertion</code> from this server. <ins>That’s all we know.</ins> ]
at com.google.firebase.auth.api.internal.zzdr.zzb(Unknown Source:18)
at com.google.firebase.auth.api.internal.zzey.zza(Unknown Source:16)
at com.google.firebase.auth.api.internal.zzeo.zzc(Unknown Source:33)
at com.google.firebase.auth.api.internal.zzeq.onFailure(Unknown Source:49)
at com.google.firebase.auth.api.internal.zzdx.dispatchTransaction(Unknown Source:18)
at com.google.android.gms.internal.firebase_auth.zza.onTransact(Unknown Source:13)
at android.os.Binder.execTransact(Binder.java:675)
Solution 1:[1]
Do you activate the support of at least 2 authentication providers on your firebase console like it's specified in the documentation?
Please check in Firebase Console => Authentication => Connection Mode and enable the connection method you needed.
Solution 2:[2]
I had this issue after hours I found out that I am connected to Iran vpn , Firebase auth doesn't work in Iran
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Romain Pamart |
| Solution 2 | Abdelhak Ketmi |
