Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: added linkedIn auth provider #13

Merged
merged 7 commits into from
Dec 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion playground/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,7 @@ NUXT_OAUTH_DISCORD_CLIENT_ID=
NUXT_OAUTH_DISCORD_CLIENT_SECRET=
# Battle.net OAuth
NUXT_OAUTH_BATTLEDOTNET_CLIENT_ID=
NUXT_OAUTH_BATTLEDOTNET_CLIENT_SECRET=
NUXT_OAUTH_BATTLEDOTNET_CLIENT_SECRET=
# LinkedIn
NUXT_OAUTH_LINKEDIN_CLIENT_ID=
NUXT_OAUTH_LINKEDIN_CLIENT_SECRET=
6 changes: 6 additions & 0 deletions playground/app.vue
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@ const providers = computed(() => [
to: '/auth/microsoft',
disabled: Boolean(user.value?.microsoft),
icon: 'i-simple-icons-microsoft',
},
{
label: user.value?.linkedin?.email || 'LinkedIn',
to: '/auth/linkedin',
disabled: Boolean(user.value?.linkedin),
icon: 'i-simple-icons-linkedin',
}

].map(p => ({
Expand Down
1 change: 1 addition & 0 deletions playground/auth.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ declare module '#auth-utils' {
microsoft?: any;
discord?: any
battledotnet?: any
linkedin?: any
}
loggedInAt: number
}
Expand Down
15 changes: 15 additions & 0 deletions playground/server/routes/auth/linkedin.get.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
export default oauth.linkedinEventHandler({
config: {
emailRequired: true
},
async onSuccess(event, { user }) {
await setUserSession(event, {
user: {
linkedin: user,
},
loggedInAt: Date.now()
})

return sendRedirect(event, '/')
}
})
Loading