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

providers/threads

內建的 Threads 整合。

ThreadsProfile

使用者

屬性

data

data: {
  id: string;
  threads_biography: string;
  threads_profile_picture_url: string;
  username: string;
};
id
id: string;

此使用者的唯一識別碼。為了避免語言和工具無法處理大型整數的問題,此識別碼會以字串形式傳回。

threads_biography?
optional threads_biography: string;

此使用者的個人檔案簡介(也稱為 bio)文字,如果使用者有提供的話。

若要傳回此欄位,請在授權請求的查詢參數中加入 fields=threads_biography

threads_profile_picture_url?
optional threads_profile_picture_url: string;

此使用者在個人檔案中顯示的個人檔案圖片網址。

若要傳回此欄位,請在授權請求的查詢參數中加入 fields=threads_profile_picture_url

username?
optional username: string;

此使用者的 Threads 帳號(使用者名稱)。

若要傳回此欄位,請在授權請求的查詢參數中加入 fields=username


default()

default(config): OAuthConfig<ThreadsProfile>

將 Threads 登入功能新增至您的頁面。

設定

回呼網址

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

組態

import { Auth } from "@auth/core"
import Threads from "@auth/core/providers/threads"
 
const request = new Request(origin)
const response = await Auth(request, {
  providers: [
    Threads({
      clientId: THREADS_CLIENT_ID,
      clientSecret: THREADS_CLIENT_SECRET,
    }),
  ],
})

資源

注意事項

⚠️

Threads API 不會傳回電子郵件地址。

💡

Threads 要求回呼網址在您的 Facebook 應用程式中設定,而 Facebook 要求您即使是 localhost 也必須使用 https!若要做到這一點,您需要為您的 localhost 新增 SSL,或是使用像是 ngrok 的 Proxy。

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

💡

Threads 提供者具有預設組態。若要針對您的使用案例覆寫預設值,請查看自訂內建 OAuth 提供者

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

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

參數

參數類型
configOAuthUserConfig<ThreadsProfile>

返回

OAuthConfig<ThreadsProfile>

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