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

providers/slack

Built-in Slack integration.

SlackProfile

Extends

  • Record<string, any>

Properties

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>

Add Slack login to your page.

Setup

Callback URL

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

Configuration

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

Resources

Notes

By default, Auth.js assumes that the Slack provider is based on the Open ID Connect specification.

🚫

Slack requires that the redirect URL of your app uses https, even for local development. An easy workaround for this is using a service like ngrok that creates a secure tunnel to your app, using https. Remember to set the url as NEXTAUTH_URL as well.

💡

The Slack 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 SlackProfile

Parameters

ParameterType
optionsOAuthUserConfig<P>

Returns

OAuthConfig<P>

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