AmaraFray
google auth
what does this even do , what is it supposed to be expecting (Required parameters were not found. Please provide them to proceed. i get this error)
await googleAuth({
client_id: c.env.GOOGLE_ID,
client_secret: c.env.GOOGLE_SECRET,
redirect_uri: 'http://localhost:5173/auth/google/callback',
scope: ['openid', 'email', 'profile'],
})(c, next)
minimum reproducable code
const app = new OpenAPIHono()
app.get('/auth/google/sign-in',
async (c : Context, next) => {
await googleAuth({
client_id: c.env.GOOGLE_ID,
client_secret: c.env.GOOGLE_SECRET,
redirect_uri: 'http://localhost:5173/auth/google/callback',
scope: ['openid', 'email', 'profile'],
})(c, next)
},
(c) => {
const token = c.get('token')
const grantedScopes = c.get('granted-scopes')
const user = c.get('user-google')
return c.json({
token,
grantedScopes,
user,
})
})
4 replies