Skip to content

Commit fec746f

Browse files
blumgartatinuxautofix-ci[bot]Barbapapazes
authored
feat: add Gitlab provider
* feat: add yandex oauth * chore: linting * update: change FormData to URLSearchParams & add config.emailRequired * up * [autofix.ci] apply automated fixes * chore(release): v0.2.0 * style: add lint script * style: add lint script * ci: update lint fix command * [autofix.ci] apply automated fixes * feat: add gitlab provider * [autofix.ci] apply automated fixes * update Supported OAuth Providers in readme * Apply suggestions from code review --------- Co-authored-by: Sébastien Chopin <[email protected]> Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> Co-authored-by: Estéban <[email protected]> Co-authored-by: Sébastien Chopin <[email protected]>
1 parent a725436 commit fec746f

File tree

11 files changed

+6764
-3254
lines changed

11 files changed

+6764
-3254
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,7 @@ It can also be set using environment variables:
195195
- Discord
196196
- Facebook
197197
- GitHub
198+
- GitLab
198199
- Google
199200
- Keycloak
200201
- LinkedIn

playground/.env.example

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ NUXT_SESSION_PASSWORD=
22
# GitHub OAuth
33
NUXT_OAUTH_GITHUB_CLIENT_ID=
44
NUXT_OAUTH_GITHUB_CLIENT_SECRET=
5+
# GitLab OAuth
6+
NUXT_OAUTH_GITLAB_CLIENT_ID=
7+
NUXT_OAUTH_GITLAB_CLIENT_SECRET=
58
# Spotify OAuth
69
NUXT_OAUTH_SPOTIFY_CLIENT_ID=
710
NUXT_OAUTH_SPOTIFY_CLIENT_SECRET=

playground/app.vue

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,12 @@ const providers = computed(() =>
4848
disabled: Boolean(user.value?.github),
4949
icon: 'i-simple-icons-github',
5050
},
51+
{
52+
label: session.value.user?.gitlab || 'GitLab',
53+
to: '/auth/gitlab',
54+
disabled: Boolean(user.value?.gitlab),
55+
icon: 'i-simple-icons-gitlab',
56+
},
5157
{
5258
label: user.value?.linkedin || 'LinkedIn',
5359
to: '/auth/linkedin',

playground/auth.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ declare module '#auth-utils' {
33
password?: string
44
spotify?: string
55
github?: string
6+
gitlab?: string
67
google?: string
78
twitch?: string
89
auth0?: string
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
export default oauthGitLabEventHandler({
2+
async onSuccess(event, { user }) {
3+
await setUserSession(event, {
4+
user: {
5+
gitlab: user.email,
6+
},
7+
loggedInAt: Date.now(),
8+
})
9+
10+
return sendRedirect(event, '/')
11+
},
12+
})

0 commit comments

Comments
 (0)