Skip to content

POC: Better Auth Google sign-in playground#437

Draft
nhyiramante1 wants to merge 4 commits into
mainfrom
poc/better-auth-google-login
Draft

POC: Better Auth Google sign-in playground#437
nhyiramante1 wants to merge 4 commits into
mainfrom
poc/better-auth-google-login

Conversation

@nhyiramante1

@nhyiramante1 nhyiramante1 commented Jun 1, 2026

Copy link
Copy Markdown
Contributor

What this is

A self-contained research spike in playgrounds/better-auth-test proving Better Auth
works in Next.js 15 before any production integration. No production code touched.

What was proven

Milestone 1 — Google OAuth sign-in ✅

  • Better Auth + Google OAuth works in Next.js 15 App Router
  • Session displays signed-in user email and name

Milestone 2A — Cookie-based protected endpoint ✅

  • GET /api/protected returns 200 + user data with valid session cookie
  • Returns 401 with no cookie

Milestone 2B — Bearer token protected endpoint ✅

  • Same route accepts Authorization: Bearer <token> with no cookie
  • Verified via browser network log with credentials: omit

Key config decisions

  • serverExternalPackages: ["better-auth", "better-sqlite3"] required in next.config.ts
  • Components using useSession() must use next/dynamic + ssr: false
  • bearer() plugin enables cookie + Bearer on the same route handler

Not included

  • No production writing-tools code changed
  • No middleware-level auth
  • Framework comparison (TanStack Start / React Router 7) is a future spike

nhyiramante1 and others added 4 commits June 1, 2026 10:41
Adds playgrounds/better-auth-test/ — an isolated Next.js 15 app to
validate whether Better Auth can handle Google OAuth + session management
before any production auth changes. Milestone 1 target: sign in with
Google, display name and email. No frontend/backend production files
touched.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant