Skip to content
Migrating from NextAuth.js v4? Read our migration guide.
API reference
mattermost

providers/mattermost

Built-in Mattermost integration.

MattermostProfile

Get a user

Properties

auth_data

auth_data: string;

auth_service

auth_service: string;

create_at

create_at: number;

The time in milliseconds a user was created

delete_at

delete_at: number;

The time in milliseconds a user was deleted

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;

Set to “true” to enable channel-wide notifications (@channel, @all, etc.), “false” to disable. Defaults to “true”.

comments
comments: string;
desktop
desktop: string;

Set to “all” to receive desktop notifications for all activity, “mention” for mentions and direct messages only, and “none” to disable. Defaults to “all”.

desktop_sound
desktop_sound: string;

Set to “true” to enable sound on desktop notifications, “false” to disable. Defaults to “true”.

desktop_threads
desktop_threads: string;
email
email: string;

Set to “true” to enable email notifications, “false” to disable. Defaults to “true”.

email_threads
email_threads: string;
first_name
first_name: string;

Set to “true” to enable mentions for first name. Defaults to “true” if a first name is set, “false” otherwise.

mention_keys
mention_keys: string;

A comma-separated list of words to count as mentions. Defaults to username and @username.

push
push: string;

Set to “all” to receive push notifications for all activity, “mention” for mentions and direct messages only, and “none” to disable. Defaults to “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;

The time in milliseconds the user accepted the terms of service

terms_of_service_id?

optional terms_of_service_id: string;

ID of accepted terms of service, if any. This field is not present if empty.

timezone

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

This value is set automatically when the “useAutomaticTimezone” is set to “true”.

manualTimezone
manualTimezone: string;

Value when setting manually the timezone, i.e. “Europe/Berlin”.

useAutomaticTimezone
useAutomaticTimezone: string;

Set to “true” to use the browser/system timezone, “false” to set manually. Defaults to “true”.

update_at

update_at: number;

The time in milliseconds a user was last updated

username

username: string;

default()

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

Add Mattermost login to your page.

Setup

Callback URL

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

Configuration

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` })],
})

Resources

Notes

By default, Auth.js assumes that the Mattermost provider is based on the OAuth 2 specification.

To create your Mattermost OAuth2 app visit http://<your Mattermost instance url>/<your team>/integrations/oauth2-apps

⚠️

The Mattermost provider requires the issuer option to be set. This is the base url of your Mattermost instance. e.g https://my-cool-server.cloud.mattermost.com

💡

The Mattermost provider comes with a default configuration. To override the defaults for your use case, check out customizing a built-in OAuth provider.

Disclaimer If you think you found a bug in the default configuration, you can open an issue.

Auth.js strictly adheres to the specification and it cannot take responsibility for any deviation from the spec by the provider. You can open an issue, but if the problem is non-compliance with the spec, we might not pursue a resolution. You can ask for more help in Discussions.

Type parameters

Type parameter
P extends MattermostProfile

Parameters

ParameterType
configOAuthUserConfig<P> & { issuer: string; }

Returns

OAuthConfig<P>

Auth.js © Balázs Orbán and Team - 2024