providers/github
GitHubEmail
属性
email: string;primary
primary: boolean;verified
verified: boolean;visibility
visibility: "private" | "public";GitHubProfile
参见
可索引
[claim: string]: unknown
属性
avatar_url
avatar_url: string;bio
bio: null | string;blog
blog: null | string;collaborators?
optional collaborators: number;company
company: null | string;created_at
created_at: string;disk_usage?
optional disk_usage: number;email: null | string;events_url
events_url: string;followers
followers: number;followers_url
followers_url: string;following
following: number;following_url
following_url: string;gists_url
gists_url: string;gravatar_id
gravatar_id: null | string;hireable
hireable: null | boolean;html_url
html_url: string;id
id: number;location
location: null | string;login
login: string;name
name: null | string;node_id
node_id: string;organizations_url
organizations_url: string;owned_private_repos?
optional owned_private_repos: number;plan?
optional plan: {
collaborators: number;
name: string;
private_repos: number;
space: number;
};collaborators
collaborators: number;name
name: string;private_repos
private_repos: number;space
space: number;private_gists?
optional private_gists: number;public_gists
public_gists: number;public_repos
public_repos: number;received_events_url
received_events_url: string;repos_url
repos_url: string;site_admin
site_admin: boolean;starred_url
starred_url: string;subscriptions_url
subscriptions_url: string;suspended_at?
optional suspended_at: null | string;total_private_repos?
optional total_private_repos: number;twitter_username?
optional twitter_username: null | string;two_factor_authentication
two_factor_authentication: boolean;type
type: string;updated_at
updated_at: string;url
url: string;default()
default(config): OAuthConfig<GitHubProfile>将 GitHub 登录添加到您的页面并向 GitHub API 发送请求。
设置
回调 URL
https://example.com/api/auth/callback/github配置
import { Auth } from "@auth/core"
import GitHub from "@auth/core/providers/github"
const request = new Request(origin)
const response = await Auth(request, {
providers: [
GitHub({ clientId: GITHUB_CLIENT_ID, clientSecret: GITHUB_CLIENT_SECRET }),
],
})资源
注意
默认情况下,Auth.js 假设 GitHub 提供商基于 OAuth 2 规范。
💡
GitHub 提供程序带有 默认配置。要覆盖您的用例的默认值,请查看 自定义内置 OAuth 提供程序.
参数
| 参数 | 类型 |
|---|---|
配置 | OAuthUserConfig<GitHubProfile> & { enterprise: { baseUrl: string; }; } |