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

providers/slack

內建的 Slack 整合。

SlackProfile

繼承自

屬性

date_email_verified

date_email_verified: number;

email

email: string;

email_verified

email_verified: boolean;

family_name

family_name: string;

given_name

given_name: string;

https://slack.com/team\_domain

com/team_domain: string;

https://slack.com/team\_id

com/team_id: string;

https://slack.com/team\_image\_102

com/team_image_102: string;

https://slack.com/team\_image\_132

com/team_image_132: string;

https://slack.com/team\_image\_230

com/team_image_230: string;

https://slack.com/team\_image\_34

com/team_image_34: string;

https://slack.com/team\_image\_44

com/team_image_44: string;

https://slack.com/team\_image\_68

com/team_image_68: string;

https://slack.com/team\_image\_88

com/team_image_88: string;

https://slack.com/team\_image\_default

com/team_image_default: boolean;

https://slack.com/team\_name

com/team_name: string;

https://slack.com/user\_id

com/user_id: string;

https://slack.com/user\_image\_1024

com/user_image_1024: string;

https://slack.com/user\_image\_192

com/user_image_192: string;

https://slack.com/user\_image\_24

com/user_image_24: string;

https://slack.com/user\_image\_32

com/user_image_32: string;

https://slack.com/user\_image\_48

com/user_image_48: string;

https://slack.com/user\_image\_512

com/user_image_512: string;

https://slack.com/user\_image\_72

com/user_image_72: string;

locale

locale: string;

name

name: string;

ok

ok: boolean;

picture

picture: string;

sub

sub: string;

default()

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

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

設定

回呼網址 (Callback URL)

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

設定組態

import { Auth } from "@auth/core"
import Slack from "@auth/core/providers/slack"
 
const request = new Request(origin)
const response = await Auth(request, {
  providers: [
    Slack({ clientId: SLACK_CLIENT_ID, clientSecret: SLACK_CLIENT_SECRET }),
  ],
})

資源

注意事項

預設情況下,Auth.js 假設 Slack 提供者基於 Open ID Connect 規範。

🚫

Slack 要求您應用程式的重新導向網址 (redirect URL) 使用 https,即使是本地開發也一樣。一個簡單的解決方案是使用像 ngrok 這樣的服務,它會使用 https 為您的應用程式建立安全的通道。請記得也將網址設定為 NEXTAUTH_URL

💡

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

免責聲明如果您認為在預設設定中發現錯誤,您可以提出問題

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

類型參數

類型參數
P 繼承 SlackProfile

參數

參數類型
選項 (options)OAuthUserConfig<P>

回傳值

OAuthConfig<P>

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