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;
合作者?
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: 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 提供者。
參數
參數 | 類型 |
---|---|
config | OAuthUserConfig <GitHubProfile > & { enterprise : { baseUrl : string ; }; } |