add oauth and create suggestion

This commit is contained in:
2023-12-09 23:03:04 +01:00
parent 4a3ff6c7ac
commit ff2d5ae7a8
9 changed files with 143 additions and 35 deletions

View File

@@ -0,0 +1,18 @@
export default oauth.githubEventHandler({
config: {
emailRequired: true,
},
async onSuccess(event: any, { user }: any) {
await setUserSession(event, {
user: {
email: user.email,
picture: user.avatar_url,
username: String(user.name).trim(),
},
})
return sendRedirect(event, '/')
},
onError(error: any) {
console.error('GitHub OAuth error:', error)
},
})