天文示例
这是一个如何在 Astro 中使用 Better Auth 的示例。它使用 Solid 来构建组件。
【This is an example of how to use Better Auth with Astro. It uses Solid for building the components.】
实现以下功能: 电子邮件和密码。使用谷歌登录的社交登录。密钥。电子邮件验证。密码重置。双因素身份验证。资料更新。会话管理
如何运行
【How to run】
-
克隆代码沙箱(或仓库)并在你的代码编辑器中打开它
-
提供包含以下变量的 .env 文件
GOOGLE_CLIENT_ID= GOOGLE_CLIENT_SECRET= BETTER_AUTH_SECRET=//if you don't have these, you can get them from the google developer console. If you don't want to use google sign-in, you can remove the google config from the
auth.tsfile. -
运行以下命令
pnpm install pnpm run dev -
Open the browser and navigate to
http://localhost:3000