Skip to content
The Auth.js project is now part of Better Auth.

GitLab Provider

Resources

Setup

Callback URL

https://example.com/api/auth/callback/gitlab

Environment Variables

AUTH_GITLAB_ID AUTH_GITLAB_SECRET

Configuration

/auth.ts
import NextAuth from "next-auth" import GitLab from "next-auth/providers/gitlab"   export const { handlers, auth, signIn, signOut } = NextAuth({  providers: [  // Default (gitlab.com)  GitLab,  // Self-hosted example  GitLab({  baseUrl: "https://gitlab.example.com",  }),  ], })

Notes

  • Enable the read_user option in scope if you want to save the users email address on sign up.
Auth.js © Better Auth Inc. - 2025