new·The score now tells you which way it movedA brain's exam only ever grows: its own material writes questions, and so does every question a real caller asked and did not get answered. The score is a percentage over that growing set, so a brain that learned more could post a smaller number — and this week three did. One of them answered two MORE questions than the week before and showed eighteen points less. Printed as a single percentage, that reads as decline to a reader and as punishment to anyone who contributes material.all news →
mozg.beta
Sign in

Better Auth · Authentication · all subjects

social sign-on/gitlab

8 notes, read out of this brain and free to use. Each one was extracted from a source and is re-checked against its exam.

GitLab OAuth credentials required

To use GitLab sign in with Better Auth, you need a client ID and client secret from GitLab. Obtain these credentials from the GitLab OAuth documentation at https://docs.gitlab.com/ee/api/oauth2.html.

GitLab redirect URL for local development

For local development, set the GitLab OAuth redirect URL to http://localhost:3000/api/auth/callback/gitlab.

GitLab redirect URL production and custom paths

For production, set the GitLab OAuth redirect URL to your application's URL. If you change the base path of the auth routes, update the redirect URL accordingly.

GitLab configuration options

GitLab provider configuration accepts the following options: clientId (required string, your GitLab application's Client ID), clientSecret (required string, your GitLab application's Client Secret), issuer (optional string, the URL of your GitLab instance, defaults to https://gitlab.com, use for self-hosted GitLab servers).

GitLab configuration example

Example configuration for GitLab social sign-on: ```ts import { betterAuth } from "better-auth" export const auth = betterAuth({ socialProviders: { gitlab: { clientId: process.env.GITLAB_CLIENT_ID as string, clientSecret: process.env.GITLAB_CLIENT_SECRET as string, issuer: process.env.GITLAB_ISSUER as string, }, }, }) ```

GitLab self-hosted configuration example

Example configuration for self-hosted GitLab instance: ```ts export const auth = betterAuth({ socialProviders: { gitlab: { clientId: process.env.GITLAB_CLIENT_ID as string, clientSecret: process.env.GITLAB_CLIENT_SECRET as string, issuer: "https://gitlab.company.com", }, }, }) ```

GitLab sign-in client usage

To sign in with GitLab on the client, use the authClient.signIn.social function with provider set to "gitlab": ```ts import { createAuthClient } from "better-auth/client" const authClient = createAuthClient() const signIn = async () => { const data = await authClient.signIn.social({ provider: "gitlab" }) } ```

GitLab issuer option for self-hosted

The issuer option is useful when using a self-hosted GitLab instance. If using GitLab.com, you can omit this option as it defaults to https://gitlab.com.

Give your agent this brain