feat(auth): migrate authentication to Better Auth - #340
Merged
Conversation
Replace custom email OTP sessions with Better Auth, wire Turnstile and Polar plugins, and move access control into apps/auth. Co-authored-by: Cursor <cursoragent@cursor.com>
Keep useFormAction and hidden email state for the OTP step while calling Better Auth from the server action. Co-authored-by: Cursor <cursoragent@cursor.com>
Align with TanStack Start client-only convention and lazy-load it from CheckoutButton to avoid SSR import protection warnings. Co-authored-by: Cursor <cursoragent@cursor.com>
Keep Polar opt-in, return a clear error when POLAR_ACCESS_TOKEN is unset, and show it via ui-lite Dialog. Co-authored-by: Cursor <cursoragent@cursor.com>
Turnstile is already enforced in the login form action, so the HTTP captcha plugin is redundant. Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Align the client module export name and update checkout callers/docs. Co-authored-by: Cursor <cursoragent@cursor.com>
Keep auth config focused on core auth and own Polar plugin wiring in payments. Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Preview and test builds set PROD=true, so product IDs and Polar server must key off CLOUDFLARE_ENV via vite --mode / getAppMode(). Co-authored-by: Cursor <cursoragent@cursor.com>
Ensures vite --mode (and getAppMode) resolve to preview instead of defaulting to production when running bun run preview. Co-authored-by: Cursor <cursoragent@cursor.com>
Payments still maps any non-production mode to preview product IDs. Co-authored-by: Cursor <cursoragent@cursor.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
allowedHosts, and related login/checkout fixesTest plan
user/admin/premium/elite) still enforce correctlybun run checkandbun run testMade with Cursor