Initial commit

This commit is contained in:
2024-07-25 18:08:53 +02:00
committed by GitHub
commit 426cbe8777
27 changed files with 13632 additions and 0 deletions

View File

@@ -0,0 +1,23 @@
export default oauth.googleEventHandler({
config: {
authorizationParams: {
access_type: 'offline',
},
},
async onSuccess(event, { user }) {
await setUserSession(event, {
user: {
name: user.name,
imageUrl: user.picture,
email: user.email,
},
})
return sendRedirect(event, '/')
},
// Optional, will return a json error and 401 status code by default
onError(event, error) {
console.error('Google OAuth error:', error)
return sendRedirect(event, '/')
},
})