Skip to content

Commit

Permalink
feat: add Gitlab provider
Browse files Browse the repository at this point in the history
* 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]>
  • Loading branch information
5 people authored Sep 11, 2024
1 parent a725436 commit fec746f
Show file tree
Hide file tree
Showing 11 changed files with 6,764 additions and 3,254 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,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

0 comments on commit fec746f

Please sign in to comment.