Skip to main content

Discord 提供者设置用于用户和权限

🌐 Discord provider setup for Users & Permissions

本页解释了如何为用户与权限功能设置 Discord 提供程序。

🌐 The present page explains how to setup the Discord provider for the Users & Permissions feature.

Prerequisites

你已阅读 用户与权限提供程序文档

🌐 You have read the Users & Permissions providers documentation.

Discord 配置

🌐 Discord configuration

Note

Discord 接受 localhost 链接。
不需要使用 ngrok

  1. 访问开发者门户的应用列表页面,网址为 https://discordapp.com/developers/applications/
  2. 点击 新建应用 按钮
  3. 填写名称并创建
  4. 点击左侧菜单中的 OAuth2
  5. 然后点击添加重定向按钮
  6. Redirect 输入框中填写 http://localhost:1337/api/connect/discord/callback URL 并保存
  7. 点击左侧菜单中的一般信息
  8. 你应该会看到你的应用 ID 和密码,保存起来供以后使用

Strapi 配置

🌐 Strapi configuration

  1. 访问用户与权限提供程序设置页面,网址为 http://localhost:1337/admin/settings/users-permissions/providers
  2. 点击 Discord 提供商
  3. 填写信息(替换为你自己的客户端 ID 和密码):
    • 启用ON
    • 客户 ID: 665118465148846081
    • 客户端密钥: iJbr7mkyqyut-J2hGvvSDch_5Dw5U77J
    • 重定向到你的前端应用的 URL: http://localhost:3000/connect/discord/redirect

你的配置已完成。启动后端和 react login example application,转到http://localhost:3000并尝试连接你配置的提供程序。