joreilly / Confetti

KMP GraphQL based conference project with Jetpack Compose Android, Compose for Wear and SwiftUI iOS clients along with GraphQL backend.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Login issue on Android

samuelepozzebon opened this issue · comments

I cannot login with Google on the current release build of the app.
I've done a bit of debugging and the problem seems to be in the SignIn.kt file, in the data provided to the Authentication.signIn (line 37) because the value that is currently being provided is the id (the email), instead of the idToken.
Because of this the Firebase authentication fails.
Either using the idToken instead of the id or changing the order of the clauses in the when fixed the issue.

Good catch! Want to open a pull request?

My only doubt is which one of the two possibile solution is the correct one, since the tokenId was removed in favor of the id in a previous PR and I don't know if it was an error or if it was an actual fix. Logging with my user always matches the first clause in the when, regardless of which one of the two is set as the first one, so I cannot really test the correctness of either solution.

TBH that other PR wasn't 100% clear to me. Using tokenId instead of just id seems a lot more correct. Plus it works on your device so I'd say let's change the first branch and leave the other one untouched. That first branch was probably a mistake from me.

This confirms it should be idToken https://developers.google.com/identity/android-credential-manager/android/reference/com/google/android/libraries/identity/googleid/GoogleIdTokenCredential

But this sounds misleading

https://developer.android.com/training/sign-in/credential-manager

If the conversion succeeds, extract the GoogleIdTokenCredential's ID, validate it, and authenticate the credential on your server.

Think we can close this?