跳到內容
從 NextAuth.js v4 遷移?請閱讀 我們的遷移指南.

providers/mastodon

內建 Mastodon 整合。

MastodonProfile

繼承自

屬性

acct

acct: string;

avatar

avatar: string;

avatar_static

avatar_static: string;

bot

bot: boolean;

created_at

created_at: string;

display_name

display_name: string;

followers_count

followers_count: number;

following_count

following_count: number;
header: string;

header_static

header_static: string;

id

id: string;

last_status_at

last_status_at: null | string;

locked

locked: boolean;

note

note: string;

statuses_count

statuses_count: number;

url

url: string;

username

username: string;

default()

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

將 Mastodon 登入新增至您的頁面。

設定

回呼 URL

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

設定

import { Auth } from "@auth/core"
import Mastodon from "@auth/core/providers/mastodon"
 
const request = new Request(origin)
const response = await Auth(request, {
  providers: [
    Mastodon({
      clientId: MASTODON_CLIENT_ID,
      clientSecret: MASTODON_CLIENT_SECRET,
      issuer: MASTODON_ISSUER,
    }),
  ],
})

資源

筆記

預設情況下,Auth.js 假設 Mastodon 提供者基於 OAuth 2 規範。

由於 Mastodon 的基礎設施是 Fediverse,您必須定義要連線的 issuer

💡

Mastodon 提供者帶有 預設設定。若要覆寫您的使用案例的預設值,請查看自訂內建的 OAuth 提供者

免責聲明 如果您認為您在預設設定中發現錯誤,您可以開啟一個問題

Auth.js 嚴格遵守規範,對於提供者偏離規範的任何情況,概不負責。您可以開啟一個問題,但如果問題是不符合規範,我們可能不會尋求解決方案。您可以在討論中尋求更多協助。

類型參數

類型參數
P 繼承自 MastodonProfile

參數

參數類型
optionsOAuthUserConfig<P> & { issuer: string; }

回傳

OAuthConfig<P>

Auth.js © Balázs Orbán 及團隊 -2024