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: add gitlab provider #161

Merged
merged 16 commits into from
Sep 11, 2024
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
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ It can also be set using environment variables:
- Discord
- Facebook
- GitHub
- GitLab
- Google
- Keycloak
- LinkedIn
Expand Down
3 changes: 3 additions & 0 deletions playground/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ NUXT_SESSION_PASSWORD=
# GitHub OAuth
NUXT_OAUTH_GITHUB_CLIENT_ID=
NUXT_OAUTH_GITHUB_CLIENT_SECRET=
# GitLab OAuth
NUXT_OAUTH_GITLAB_CLIENT_ID=
NUXT_OAUTH_GITLAB_CLIENT_SECRET=
# Spotify OAuth
NUXT_OAUTH_SPOTIFY_CLIENT_ID=
NUXT_OAUTH_SPOTIFY_CLIENT_SECRET=
Expand Down
6 changes: 6 additions & 0 deletions playground/app.vue
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,12 @@ const providers = computed(() =>
disabled: Boolean(user.value?.github),
icon: 'i-simple-icons-github',
},
{
label: session.value.user?.gitlab || 'GitLab',
to: '/auth/gitlab',
disabled: Boolean(user.value?.gitlab),
icon: 'i-simple-icons-gitlab',
},
{
label: user.value?.linkedin || 'LinkedIn',
to: '/auth/linkedin',
Expand Down
1 change: 1 addition & 0 deletions playground/auth.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ declare module '#auth-utils' {
password?: string
spotify?: string
github?: string
gitlab?: string
google?: string
twitch?: string
auth0?: string
Expand Down
12 changes: 12 additions & 0 deletions playground/server/routes/auth/gitlab.get.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
export default oauthGitLabEventHandler({
async onSuccess(event, { user }) {
await setUserSession(event, {
user: {
gitlab: user.email,
},
loggedInAt: Date.now(),
})

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