Zoom
Zoom 提供者的设置和使用。
从 Marketplace 创建 Zoom 应用
-
访问 Zoom Marketplace。
-
将鼠标悬停在
Develop按钮上并选择Build App -
选择
General App并点击Create
配置你的 Zoom 应用
确保你位于应用设置的 Basic Information 页面。
-
在
Select how the app is managed中,选择User-managed -
在
App Credentials下,复制你的Client ID和Client Secret并存储在安全的位置 -
在
OAuth Information->OAuth Redirect URL中,添加你的回调 URL。例如,http://localhost:3000/api/auth/callback/zoom对于生产环境,你应该将其设置为应用程序的 URL。如果更改了认证路由的基本路径,你需要相应地更新重定向 URL。
转到 Scopes 部分,然后
- 点击
Add Scopes按钮 - 搜索
user:read:user(查看用户)并选择它 - 添加应用程序需要的其他范围并点击
Done
配置提供者
要配置提供者,你需要导入该提供者并将其传递给认证实例的 socialProviders 选项。
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 指定为提供者。
import { createAuthClient } from "better-auth/client"
const authClient = createAuthClient()
const signIn = async () => {
const data = await authClient.signIn.social({
provider: "zoom"
})
}