Expo Google login

I'm using better-auth with Expo for Google social login. In the socialProviders config, I see that Google requires both clientId and clientSecret, but as far as I understand, when using the Android client (for mobile), Google doesn't provide a clientSecret. If I try to leave it as undefined, I get a type error.
socialProviders: {
google: {
clientId: process.env.GOOGLE_CLIENT_ID as string,
clientSecret: ??? // ← what should I put here?
},
},
socialProviders: {
google: {
clientId: process.env.GOOGLE_CLIENT_ID as string,
clientSecret: ??? // ← what should I put here?
},
},
Since I'm using Expo (and not a web app), is there a correct way to omit clientSecret? Or is there a workaround to bypass the type check? Any advice appreciated!
Solution:
Oh wait, if you’re authenticating in the expo app, you should get idToken and you should use id token auth instead.
Jump to solution
7 Replies
daveycodez
daveycodez2w ago
Did you try a random string to see if it works Since it won’t use it anyway ?
melodyclue
melodyclueOP2w ago
@daveycodez yes, it becomes 400 error
No description
bekacru
bekacru2w ago
you can just provide a random value for now :))
melodyclue
melodyclueOP2w ago
Hmm, for some reason I'm getting a 400 error — do you have any idea what might be causing it? @bekacru
No description
Solution
bekacru
bekacru2w ago
Oh wait, if you’re authenticating in the expo app, you should get idToken and you should use id token auth instead.
bekacru
bekacru2w ago
If you actually want to open the browser and use better auth to authenticate using google, client secret is required
melodyclue
melodyclueOP2w ago
@bekacru It works ! thanks

Did you find this page helpful?