I'm trying to use firebase google authentication for my Android App. Firstly I initialize Google Client as a documentation :
gso = GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)
.requestIdToken(getString(R.string.default_web_client_id))
.requestEmail()
.build()
mGoogleSignInClient = GoogleSignIn.getClient(this, gso);
Google Sign-In button click listener:
googleSignInBtn.setOnClickListener({
val signInIntent = mGoogleSignInClient.signInIntent
startActivityForResult(signInIntent, RC_SIGN_IN)
})
My activity result :
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent) {
super.onActivityResult(requestCode, resultCode, data)
if (requestCode == RC_SIGN_IN) {
val task: Task<GoogleSignInAccount> = GoogleSignIn.getSignedInAccountFromIntent(data)
try {
val account = task.getResult(ApiException::class.java)
firebaseAuthWithGoogle(account)
} catch (e: ApiException) {
Log.w(TAG, "Google sign in failed status code:"+e.statusCode);
}
}
}
I added both release and debug sha-1 fingerprint to firebase console. There is no problem in debugging mode, it works. But when I'm trying in release mode , I'm getting DEVELOPER ERROR. How can I fix this problem ? Thank you.