This is an example fork of how to use Better Auth with Astro. It uses Solid for building the components.
Implements the following features:
- Email & Password
- Social Sign-in with Google and Gitbub
- Passkeys
- Email Verification
- Password Reset
- Two Factor Authentication
- Profile Update
- Session Management
- Upgrades to astro v6 and tailwind v4.
- Migrates legacy tailwind config file
- WIP: Migrating tailwind plugins
- WIP: Darkmode support.
- Adjusted .gitignore file
-
Clone the code sandbox (or the repo) and open it in your code editor
-
Provide .env file with the following variables
GITHUB_CLIENT_ID= GITHUB_CLIENT_SECRET= GOOGLE_CLIENT_ID= GOOGLE_CLIENT_SECRET= BETTER_AUTH_SECRET=
//if you don't have these, you can get them from the google developer console and github developer settings. If you don't want to use google or github sign-in, you can remove the config from the auth.ts file.
Authorization callback URL
Github:http://localhost:3000/api/auth/callback/githubGoogle:http://localhost:3000/api/auth/callback/google -
Run the following commands
bun i bun dev
-
Open the browser and navigate to
http://localhost:3000