react-native-google-signin / google-signin

Google Sign-in for your React Native applications
https://react-native-google-signin.github.io/
MIT License
3.12k stars 877 forks source link

Cannot get signIn() working with Supabase #1307

Open asindhu opened 1 week ago

asindhu commented 1 week ago

Hi! Trying to call .signIn(). I'm using Expo & react-native. I get the DEVELOPER_ERROR issue. I have carefully followed all the docs from Supabase and from this repo, including reviewing all of the FAQ/troubleshooting/common causes of the DEVELOPER_ERROR. The code is simple:

GoogleSignin.configure({
  webClientId: '...'
})

await GoogleSignin.hasPlayServices()
const userInfo = await GoogleSignin.signIn() // < fails here

I can get this to work in a development build only using the OAuth web flow -- by creating a web type key in Google Cloud, then copying the client key and secret into Supabase, and providing that web client ID into the .configure() method. However, this does not work in a production build -- I get the DEVELOPER_ERROR.

Alternatively I've tried creating an Android-type key in GC (this is what Supabase docs tell you to do) with a SHA-1. So create an Android key in GC, give it a SHA-1, copy its client ID, and pass that into .configure(). However, none of these keys/SHA-1s work either in development or production. I've tried SHA-1s from the following sources:

What am I doing wrong in my config here? Totally stuck. I'm further confused by the fact that the docs for this module say that you can only pass a "web client", not "Android" type GC key to the "webClientId" arg of .configure() (that part makes sense) -- but... the only way in GC that you can set a SHA-1 is on an Android-type GC key. So how am I supposed to be setting up a SHA-1 if I'm using a web client auth key in GC, not Android? Where am I linking an Android key, with a SHA-1, to my react-native-google-signin config, if I never pass in its client ID?

Right now in GC I have the web key set up and 4 different Android keys representing the 4 SHA-1s above, I've entered all that into Supabase, and yet I still can't get the sign in working by passing in any of the 5 corresponding client IDs as the webClientId arg of configure() -- except the web client key, in development builds only.

Given that the call fails before I even interact with Supabase I'm assuming it's upstream from that, but again this confuses me since the docs for this module, when discussing Firebase, mention that the DEVELOPER_ERROR is usually an issue with the Firebase config (presumably it would be similar with Supabase).

Thanks so much in advance for any assistance and apologies if anything is not clear or done according to convention, happy to do whatever additional work is needed to receive guidance.

Expected Behavior

signIn() method should succeed and return a token to log in with Supabase.

Actual Behavior

signIn() method returns DEVELOPER_ERROR

Environment

s-ruzen-ebs commented 1 week ago

We had the same kind of problem. In our case, we came to realize that our webClienId was wrong. We had initially set client_id of oauth_client from google-services.json.

However it seems, it was supposed to be the client_id of "other_platform_oauth_client" present in the google-servieces.json

asindhu commented 1 week ago

We had the same kind of problem. In our case, we came to realize that our webClienId was wrong. We had initially set client_id of oauth_client from google-services.json.

However it seems, it was supposed to be the client_id of "other_platform_oauth_client" present in the google-servieces.json

Hey there, thanks for the response! Unfortunately I'm not using Firebase, so I don't believe I have a google-services.json file at all. I'm using Supabase, which I believe doesn't require this. If I'm mistaken please let me know. Thanks again.

0xifis commented 2 days ago

@asindhu any updates on this error. Hitting a similar road block as well

AhmedAlsudairy commented 1 day ago

Me too I have same error

asindhu commented 1 day ago

No updates yet folks, sorry... I have not been able to get it working.