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

providers/mattermost

內建 Mattermost 整合。

MattermostProfile

取得使用者

屬性

auth_data

auth_data: string;

auth_service

auth_service: string;

create_at

create_at: number;

使用者建立的時間(以毫秒為單位)

delete_at

delete_at: number;

使用者刪除的時間(以毫秒為單位)

disable_welcome_email

disable_welcome_email: boolean;

email

email: string;

email_verified

email_verified: boolean;

first_name

first_name: string;

id

id: string;

last_name

last_name: string;

last_password_update

last_password_update: number;

locale

locale: string;

nickname

nickname: string;

notify_props

notify_props: {
  channel: string;
  comments: string;
  desktop: string;
  desktop_sound: string;
  desktop_threads: string;
  email: string;
  email_threads: string;
  first_name: string;
  mention_keys: string;
  push: string;
  push_status: string;
  push_threads: string;
};
channel
channel: string;

設定為「true」以啟用頻道範圍的通知(@channel、@all 等),設定為「false」以停用。預設為「true」。

comments
comments: string;
desktop
desktop: string;

設定為「all」以接收所有活動的桌面通知,設定為「mention」僅接收提及和直接訊息的通知,設定為「none」以停用。預設為「all」。

desktop_sound
desktop_sound: string;

設定為「true」以啟用桌面通知的音效,設定為「false」以停用。預設為「true」。

desktop_threads
desktop_threads: string;
email
email: string;

設定為「true」以啟用電子郵件通知,設定為「false」以停用。預設為「true」。

email_threads
email_threads: string;
first_name
first_name: string;

設定為「true」以啟用名字的提及。如果已設定名字,則預設為「true」,否則為「false」。

mention_keys
mention_keys: string;

以逗號分隔的單字列表,用於計算為提及。預設為使用者名稱和 @使用者名稱。

push
push: string;

設定為「all」以接收所有活動的推播通知,設定為「mention」僅接收提及和直接訊息的通知,設定為「none」以停用。預設為「mention」。

push_status
push_status: string;
push_threads
push_threads: string;

position

position: string;

roles

roles: string;

terms_of_service_create_at?

optional terms_of_service_create_at: number;

使用者接受服務條款的時間(以毫秒為單位)

terms_of_service_id?

optional terms_of_service_id: string;

已接受的服務條款 ID(如果有的話)。如果此欄位為空,則不存在。

timezone

timezone: {
  automaticTimezone: string;
  manualTimezone: string;
  useAutomaticTimezone: string;
};
automaticTimezone
automaticTimezone: string;

當「useAutomaticTimezone」設定為「true」時,此值會自動設定。

manualTimezone
manualTimezone: string;

當手動設定時區時的值,例如 “Europe/Berlin”。

useAutomaticTimezone
useAutomaticTimezone: string;

設定為 “true” 以使用瀏覽器/系統時區,設定為 “false” 以手動設定。預設為 “true”。

update_at

update_at: number;

使用者上次更新時間,以毫秒為單位。

username

username: string;

預設值()

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

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

設定

回呼網址

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

設定

import { Auth } from "@auth/core"
import Mattermost from "@auth/core/providers/mattermost"
 
const request = new Request(origin)
const response = await Auth(request, {
  providers: [
    Mattermost({
      clientId: MATTERMOST_CLIENT_ID,
      clientSecret: MATTERMOST_CLIENT_SECRET,
      issuer: MATTERMOST_ISSUER, // The base url of your Mattermost instance. e.g `https://my-cool-server.cloud.mattermost.com`
    }),
  ],
})

資源

注意事項

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

要建立您的 Mattermost OAuth2 應用程式,請訪問 http://<您的 Mattermost 實例網址>/<您的團隊>/integrations/oauth2-apps

⚠️

Mattermost 提供者需要設定 issuer 選項。這是您的 Mattermost 實例的基本網址。例如 https://my-cool-server.cloud.mattermost.com

💡

Mattermost 提供者帶有 預設配置。要覆寫您用例的預設值,請查看自訂內建的 OAuth 提供者

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

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

類型參數

類型參數
P 擴展 MattermostProfile

參數

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

回傳值

OAuthConfig<P>

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