providers/reddit
default()
default(config): OAuthConfig<Record<string, any>>
將 Reddit 登入新增至您的頁面。
設定
回呼 URL
https://example.com/api/auth/callback/reddit
組態
import { Auth } from "@auth/core"
import Reddit from "@auth/core/providers/reddit"
const request = new Request(origin)
const response = await Auth(request, {
providers: [
Reddit({ clientId: REDDIT_CLIENT_ID, clientSecret: REDDIT_CLIENT_SECRET }),
],
})
資源
注意事項
依預設,Auth.js 假設 Reddit 提供者是基於 OAuth 2 規格。
🚫
每次您瀏覽 Reddit 頁面時,Reddit 都需要授權。每個用戶端 ID / 用戶端密碼只允許一個回呼 URL。
💡
此提供者範本只有一小時的存取權杖,並且只有「identity」範圍。如果您也想要取得重新整理權杖,您必須遵循此方法
providers: [
Reddit({
clientId: process.env.REDDIT_CLIENT_ID,
clientSecret: process.env.REDDIT_CLIENT_SECRET,
authorization: {
params: {
duration: 'permanent',
},
},
}),
]
💡
Reddit 提供者隨附 預設組態。若要覆寫您使用案例的預設值,請查看自訂內建 OAuth 提供者。
參數
參數 | 類型 |
---|---|
config | OAuthUserConfig <Record <string , any >> |
回傳
OAuthConfig
<Record
<string
, any
>>