Skip to content
masterclassBuddyTech Buzz5 fresh blogs · 5:00 AM IST

Auth.js · Const

Slack

Auth.js provides a built-in Slack provider for adding Slack sign-in. Configure the Slack client credentials, register the HTTPS callback URL, and include Slack in the Auth.js provider list.

How it works

The Slack provider is a built-in OAuth/OIDC integration. Add it to the provider list, configure the Slack client credentials through the expected environment variables, and register the matching HTTPS callback URL in Slack.

Syntax

Slack(options): OAuthConfig<P>

Key points

  • Slack is available as a built-in Auth.js sign-in provider.
  • The documented environment variable names are AUTH_SLACK_ID and AUTH_SLACK_SECRET.
  • A Next.js application registers the callback at /api/auth/callback/slack.
  • The built-in provider can be used without manually recreating Slack's OAuth/OIDC settings.
  • Use provider customization when the supplied defaults do not meet the application's requirements.

Common mistakes

  • The callback URL must use HTTPS, including during local development; an HTTPS tunnel can provide a suitable local URL.
  • The provider uses an OIDC-based default configuration, so custom settings should follow the documented provider-customization approach when needed.

Example: Configure Slack sign-in

import NextAuth from "next-auth"
import Slack from "next-auth/providers/slack"

export const { handlers, auth, signIn, signOut } = NextAuth({
  providers: [Slack],
})

Register Slack as a built-in provider in the Auth.js configuration; the provider reads its client credentials from the documented environment variables.

When to use it

Next.js Slack login

Add Slack sign-in to a Next.js Auth.js application using the built-in provider.

Framework-specific integration

Connect Slack authentication to another Auth.js integration by registering its framework-specific callback path.

Customized provider configuration

Adapt the provider when the built-in OIDC-oriented defaults do not fit a deployment.

Interview questions

QHow do you configure Slack in a Next.js Auth.js application?

Import the framework-specific Slack provider and include it in the Auth.js providers array. For Next.js, the documented setup uses Slack directly and obtains credentials from AUTH_SLACK_ID and AUTH_SLACK_SECRET.

Follow-up: What callback URL must be registered? Use https://example.com/api/auth/callback/slack for Next.js; other integrations use the framework-specific callback path shown in the provider documentation.

QWhat credentials and callback configuration does Slack require?

Set AUTH_SLACK_ID and AUTH_SLACK_SECRET, then register the application callback URL in Slack. The Next.js callback path is /api/auth/callback/slack.

Follow-up: Why can local development fail even with correct credentials? Slack requires the redirect URL to use HTTPS, so use an HTTPS tunnel and configure the corresponding Auth.js URL.

QWhen should the built-in Slack configuration be overridden?

The provider supplies defaults, so the normal setup only adds Slack to the provider list. If those defaults do not fit the application, use Auth.js's documented customization mechanism for built-in OAuth providers.

Follow-up: What protocol does the default provider configuration assume? It assumes OpenID Connect, which affects how a customized configuration should be designed.

  • SlackProfile
  • OAuthConfig
  • OAuthUserConfig
  • customizing a built-in OAuth provider

Source: Slack | Auth.js. Checked 2026-10-15.