跳至内容
从 NextAuth.js v4 迁移?阅读 我们的迁移指南.

providers/slack

内置 Slack 集成。

SlackProfile

扩展

属性

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>

在您的页面上添加 Slack 登录。

设置

回调 URL

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

配置

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

资源

备注

默认情况下,Auth.js 假设 Slack 提供者基于 Open ID Connect 规范。

🚫

Slack 要求您的应用的重定向 URL 使用 https,即使是本地开发。解决此问题的一个简单方法是使用 ngrok 等服务,该服务使用 https 创建到您的应用的安全隧道。请记住将 url 设置为 NEXTAUTH_URL

💡

Slack 提供者附带一个 默认配置。要覆盖您的用例的默认值,请查看 自定义内置 OAuth 提供者

免责声明 如果您认为在默认配置中发现了一个错误,您可以 打开一个问题

Auth.js 严格遵守规范,它无法对提供者与规范的任何偏差负责。您可以打开一个问题,但如果问题是不符合规范,我们可能不会寻求解决。您可以在 Discussions 中寻求更多帮助。

类型参数

类型参数
P 扩展 SlackProfile

参数

参数类型
optionsOAuthUserConfig<P>

返回

OAuthConfig<P>

Auth.js © Balázs Orbán 和团队 -2024