Could you confirm if your error is the same as @Ada_Lovelace“illegal base64 data at byte…” . Could you please share the error stack trace and code snippet giving the error?
private fun handleSignInResult(completedTask: Task<GoogleSignInAccount>) {
showProgressDialog("Autentificare in curs!")
try {
if (completedTask.isSuccessful) {
val account = completedTask.getResult(ApiException::class.java)
val token = account.idToken
val email: String? = account?.email
val firstName = account?.givenName
val googleCredentials = Credentials.google(token, GoogleAuthType.ID_TOKEN)
taskApp?.loginAsync(googleCredentials) { it ->
if (it.isSuccess) {
Log.v(
"AUTH",
"Successfully logged in to MongoDB Realm using Google OAuth."
)
Helpers().setLoginSuccesfoul(this, true)
Helpers().setAuthProvider(this,"google")
//TODO: 1 are limite setate in cont? daca nu are inseamna ca este un user now daca da inseamana ca este un user vechi
checkifAccountIsNeeded(email, firstName)
} else {
hideProgressDialog()
onLoginFailed("Nu s-a putut crea contul,${it.error}")
Log.e(
"AUTH",
"Failed to log in to MongoDB Realm: ", it.error
)
}
}
} else {
Log.e(
"AUTH", "Google Auth failed: "
+ completedTask.exception.toString()
)
onLoginFailed("Google Auth failed:,${completedTask.exception.toString()}")
}
} catch (e: ApiException) {
Log.w("AUTH", "Failed to log in with Google OAuth: " + e.message)
onLoginFailed("Failed to log in with Google OAuth::,${e.message}")
}
}