跳到内容
从 NextAuth.js v4 迁移?阅读 我们的迁移指南.

providers/gitlab

内置 GitLab 集成。

GitLabProfile

扩展

属性

avatar_url

avatar_url: string;

bio

bio: string;

bot

bot: boolean;

can_create_group

can_create_group: boolean;

can_create_project

can_create_project: boolean;

color_scheme_id

color_scheme_id: number;

commit_email

commit_email: string;

confirmed_at

confirmed_at: string;

created_at

created_at: string;

current_sign_in_at

current_sign_in_at: string;

email

email: string;

external

external: boolean;

extra_shared_runners_minutes_limit

extra_shared_runners_minutes_limit: number;

followers

followers: number;

following

following: number;

id

id: number;

identities

identities: {
  extern_uid: string;
  provider: string;
  }[];

job_title

job_title: string;

last_activity_on

last_activity_on: string;

last_sign_in_at

last_sign_in_at: string;

linkedin

linkedin: string;

local_time

local_time: string;

location?

optional location: string;

name

name: string;

organization

organization: string;

private_profile

private_profile: boolean;

projects_limit

projects_limit: number;

pronouns

pronouns: string;

public_email

public_email: string;

shared_runners_minutes_limit

shared_runners_minutes_limit: number;

skype

skype: string;

state

state: string;

theme_id

theme_id: number;

twitter

twitter: string;

two_factor_enabled

two_factor_enabled: boolean;

username

username: string;

web_url

web_url: string;

website_url

website_url: string;

work_information?

optional work_information: string;

default()

default<P>(options): OAuthConfig<P>

将 GitLab 登录添加到您的页面。

设置

回调 URL

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

配置

import { Auth } from "@auth/core"
import GitLab from "@auth/core/providers/gitlab"
 
const request = new Request(origin)
const response = await Auth(request, {
  providers: [
    GitLab({ clientId: GITLAB_CLIENT_ID, clientSecret: GITLAB_CLIENT_SECRET }),
  ],
})

资源

备注

默认情况下,Auth.js 假设 GitLab 提供商基于 OAuth 2 规范。

💡

如果要保存用户在注册时的电子邮件地址,请在范围中启用 read_user 选项。

💡

GitLab 提供商带有 默认配置。要覆盖您的用例的默认值,请查看 自定义内置 OAuth 提供商

免责声明如果您认为在默认配置中发现了一个错误,您可以 打开一个问题

Auth.js 严格遵守规范,对于提供商在规范方面有任何偏差,Auth.js 概不负责。您可以打开一个问题,但如果问题是非规范合规性,我们可能不会寻求解决方案。您可以在 Discussions 中寻求更多帮助。

类型参数

类型参数
P 扩展 GitLabProfile

参数

参数类型
optionsOAuthUserConfig<P>

返回值

OAuthConfig<P>

Auth.js © Balázs Orbán 和团队 -2024