N
Nuxt9mo ago
BharathB

Sign in with Google not working in Production

Hi all. I use passport-google-oauth20 with Nodejs backend and mysql database on Nuxt3. Sign in with Google works fine in localhost. But its not working in production. I get this error (Screenshot attached.) I understand that wrong runtimeConfig may break Public or private may break . But I am not finding where it is wrong. Also the error is generic. Please help. I'm happy to provide more details.
No description
No description
No description
2 Replies
Zhaolin Lau
Zhaolin Lau9mo ago
@BharathB try this:
const config = useRuntimeConfig()

passport.user(new GoogleStrategy({
clientID: config.googleClientId,
clientSecret: config.googleClientSecret,
callbackURL: '/api/auth/google/callback',
scope: ['profile', 'email']
},
const config = useRuntimeConfig()

passport.user(new GoogleStrategy({
clientID: config.googleClientId,
clientSecret: config.googleClientSecret,
callbackURL: '/api/auth/google/callback',
scope: ['profile', 'email']
},
Cue
Cue9mo ago
useRuntimeConfig is a Nuxt utility. His backend is not using Nuxt.

Did you find this page helpful?