joreilly / Confetti

KMP GraphQL based conference project with Jetpack Compose Android, Compose for Wear and SwiftUI iOS clients along with GraphQL backend.
Apache License 2.0
679 stars 82 forks source link

Login issue on Android #1318

Open samuelepozzebon opened 2 weeks ago

samuelepozzebon commented 2 weeks ago

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.

martinbonnin commented 2 weeks ago

Good catch! Want to open a pull request?

samuelepozzebon commented 2 weeks ago

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.

martinbonnin commented 2 weeks ago

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.

yschimke commented 2 weeks ago

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.