コンテンツへスキップ
NextAuth.js v4 からの移行ですか?以下をお読みください 移行ガイド.

providers/github

組み込みのGitHub連携。

GitHubEmail

プロパティ

email

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

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プロバイダーのカスタマイズをご確認ください。

免責事項 デフォルト設定にバグがあると思われる場合は、問題を提起できます。

Auth.jsは仕様に厳密に準拠しており、プロバイダーによる仕様からの逸脱について責任を負うことはできません。問題を提起することはできますが、問題が仕様の非準拠である場合、解決を追求しない可能性があります。ディスカッションでさらにヘルプを求めることができます。

パラメーター

パラメーター
configOAuthUserConfig<GitHubProfile> & { enterprise: { baseUrl: string; }; }

戻り値

OAuthConfig<GitHubProfile>

Auth.js © Balázs Orbán and Team -2024