providers/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 提供者。
參數
參數 | 類型 |
---|---|
config | OAuthUserConfig <ThreadsProfile > |