Zoom

从市场创建 Zoom 应用

  1. 访问 Zoom Marketplace

  2. 将鼠标悬停在“开发”按钮上,然后选择“构建应用”

  3. 选择 General App 并点击 Create

配置你的 Zoom 应用

确保你位于应用设置的“基本信息”中。

  1. 在“选择应用的管理方式”下,选择“用户管理”

  2. 在“应用凭证”下,复制你的“客户端 ID”和“客户端密钥”,并将它们保存在安全的地方

  3. OAuth 信息 -> OAuth 重定向 URL 下,添加你的回调 URL。例如,

    http://localhost:3000/api/auth/callback/zoom

    在生产环境中,你应将其设置为你的应用的 URL。如果你更改了身份验证路由的基础路径,也应相应地更新重定向 URL。

跳到“Scopes”部分,然后

  1. 点击“添加 Scopes”按钮
  2. 搜索“user:read:user”(查看用户)并选择它
  3. 添加你的应用需要的其他 Scopes,然后点击“完成”

配置提供程序

要配置提供程序,你需要导入该提供程序并将其传递给 auth 实例的 socialProviders 选项。

auth.ts
import { betterAuth } from "better-auth"

export const auth = betterAuth({
  socialProviders: {
    zoom: { 
      clientId: process.env.ZOOM_CLIENT_ID as string, 
      clientSecret: process.env.ZOOM_CLIENT_SECRET as string, 
    }, 
  },
})

使用 Zoom 登录

要使用 Zoom 登录,你可以使用客户端提供的 signIn.social 函数。 你需要将 zoom 指定为提供商。

auth-client.ts
import { createAuthClient } from "better-auth/client"
const authClient =  createAuthClient()

const signIn = async () => {
  const data = await authClient.signIn.social({
    provider: "zoom"
  })
}

On this page