Zoom

从应用市场创建 Zoom 应用

  1. 访问 Zoom 应用市场

  2. 将鼠标悬停在 Develop 按钮上并选择 Build App

  3. 选择 General App 并点击 Create

配置你的 Zoom 应用

确保你在应用设置的 Basic Information 部分。

  1. Select how the app is managed 下,选择 User-managed

  2. App Credentials 下,复制你的 Client IDClient Secret 并安全存储

  3. OAuth Information -> OAuth Redirect URL 下,添加你的回调 URL。例如:

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

    对于生产环境,你应该将其设置为你的应用程序的 URL。如果你更改了认证路由的基础路径,你应该相应地更新重定向 URL。

跳转到 Scopes 部分,然后:

  1. 点击 Add Scopes 按钮
  2. 搜索 user:read:user(查看用户)并选择它
  3. 添加你的应用程序需要的其他作用域,然后点击 Done

配置提供商

要配置提供商,你需要导入提供商并将其传递给 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 函数。 你需要将 provider 指定为 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