Next.js 示例
这是一个如何在 Next 中使用 Better Auth 的示例。
【This is an example of how to use Better Auth with Next.】
实现以下功能: 电子邮件和密码、社交登录、密码密钥、电子邮件验证、密码重置、双因素认证、个人资料更新、会话管理、组织、成员和角色
查看 演示
【See Demo】
如何运行
【How to run】
-
克隆代码沙箱(或仓库)并在你的代码编辑器中打开它
-
将 .env.example 改名为 .env 并提供必要的变量
-
运行以下命令
pnpm install pnpm dev -
Open the browser and navigate to
http://localhost:3000
单点登录示例
【SSO Login Example】
在这个例子中,我们使用 DummyIDP。请从 DummyIDP 登录 发起登录,点击“继续”,然后系统将会引导你进入用户的仪表板。
【For this example, we utilize DummyIDP. Initiate the login from the DummyIDP login, click "Proceed", and from here it will direct you to user's dashboard.】
SCIM 同步示例
【SCIM Sync Example】
在这个示例中,我们使用 DummyIDP。前往 IDP 仪表板 尝试添加、更新或删除用户,然后前往管理页面或直接访问你的数据库,观察同步操作的运行情况。
【For this example, we utilize DummyIDP. Head out to the IDP dashboard and try to add, update or remove users, then go to the admin page or directly to your database and watch the synchronization work.】