I'm using google auth in my app but I can't get it to work. My currently error is
com.google.android.gms.common.api.ApiException: 10: at com.google.android.gms.common.internal.ApiExceptionUtil.fromStatus(Unknown Source) at com.google.android.gms.auth.api.signin.GoogleSignIn.getSignedInAccountFromIntent(Unknown Source) at br.com.etc.login.LoginActivity.onActivityResult(LoginActivity.kt:123)
My LoginActivity:
class LoginActivity : AppCompatActivity() {
private var googleSignInClient: GoogleSignInClient? = null
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_login)
val gso = GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)
.requestEmail()
.requestIdToken(getString(R.string.google_client_id))
.build()
googleSignInClient = GoogleSignIn.getClient(this, gso)
bt_login_google.onClick {
val signInIntent = googleSignInClient!!.signInIntent
startActivityForResult(signInIntent, RC_SIGN_IN)
}
}
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
super.onActivityResult(requestCode, resultCode, data)
if (requestCode == RC_SIGN_IN) {
val task = GoogleSignIn.getSignedInAccountFromIntent(data)
handleSignInResult(task)
}
}
private fun handleSignInResult(completedTask: Task<GoogleSignInAccount>) {
try {
val account = completedTask.getResult(ApiException::class.java)
vm.loginGoogle(account?.idToken ?: "")
} catch (e: ApiException) {
Snackbar.make((findViewById(android.R.id.content)), R.string.error_generic, Snackbar.LENGTH_SHORT)
.show()
Timber.e(e)
}
}
}
I'm getting my SHA1 doing from Gradle>App>tasks>android>signinReport

I added my SHA1 to https://console.developers.google.com/apis/credentials now looks like this:

My (R.string.google_client_id) is the Client ID
So I went to my firebase project (I'm only using for the analytics), went to project settings and added the SHA1. I also added a support email. I downloaded the google-settings.json and added to my project. IDk if it's important but my app is not published, I don't have a google developer account.
I know this is a common question but I tried everything I could think of and I'm still having stuck with this problem.