Slack OAuth provider

OAuth integration for Slack. Provider id is slack.

import { slack } from "@lucia-auth/oauth/providers";
import { auth } from "./lucia.js";

const slackAuth = slack(auth, configs);

slack()#

Scopes openid and profile are always included.

const slack: (
	auth: Auth,
	configs: {
		clientId: string;
		clientSecret: string;
		redirectUri: string;
		scope?: string[];
	}
) => SlackProvider;
Parameters#
nametypedescriptionoptional
authAuthLucia instance
config.clientIdstringSlack OAuth app client id
config.clientSecretstringSlack OAuth app client secret
config.redirectUristringan authorized redirect URI (must be HTTPS)
config.scopestring[]an array of scopes
Returns#
typedescription
SlackProviderSlack provider

Interfaces#

SlackAuth#

See OAuth2ProviderAuth.

// implements OAuth2ProviderAuth<SlackAuth<_Auth>>
interface SlackAuth<_Auth extends Auth> {
	getAuthorizationUrl: () => Promise<readonly [url: URL, state: string]>;
	validateCallback: (code: string) => Promise<SlackUserAuth<_Auth>>;
}
Generics#
nameextendsdefault
_AuthAuthAuth

SlackTokens#

type SlackTokens = {
	accessToken: string;
	idToken: string;
};

SlackUser#

type SlackUser = {
	sub: string;
	"https://slack.com/user_id": string;
	"https://slack.com/team_id": string;
	email?: string;
	email_verified: boolean;
	date_email_verified: number;
	name: string;
	picture: string;
	given_name: string;
	family_name: string;
	locale: string;
	"https://slack.com/team_name": string;
	"https://slack.com/team_domain": string;
	"https://slack.com/user_image_24": string;
	"https://slack.com/user_image_32": string;
	"https://slack.com/user_image_48": string;
	"https://slack.com/user_image_72": string;
	"https://slack.com/user_image_192": string;
	"https://slack.com/user_image_512": string;
	"https://slack.com/team_image_34": string;
	"https://slack.com/team_image_44": string;
	"https://slack.com/team_image_68": string;
	"https://slack.com/team_image_88": string;
	"https://slack.com/team_image_102": string;
	"https://slack.com/team_image_132": string;
	"https://slack.com/team_image_230": string;
	"https://slack.com/team_image_default": true;
};

SlackUserAuth#

Extends ProviderUserAuth.

interface SlackUserAuth<_Auth extends Auth> extends ProviderUserAuth<_Auth> {
	slackUser: SlackUser;
	slackTokens: SlackTokens;
}
propertiestypedescription
slackUserSlackUserSlack user
slackTokensSlackTokensAccess tokens etc
Generics#
nameextends
_AuthAuth