Skip to content

fix(auth): improve local oauth dx#102

Merged
onmax merged 3 commits intomainfrom
fix/local-oauth-dx-main
Feb 11, 2026
Merged

fix(auth): improve local oauth dx#102
onmax merged 3 commits intomainfrom
fix/local-oauth-dx-main

Conversation

@onmax
Copy link
Collaborator

@onmax onmax commented Feb 11, 2026

Summary

  • hydrate runtimeConfig.public.siteUrl from NUXT_PUBLIC_SITE_URL when missing, while preserving explicit runtime config precedence
  • normalize loopback host variants (127.0.0.1, ::1) to localhost in dev baseURL resolution to reduce local OAuth origin/callback mismatches
  • add one-time dev diagnostic logging when baseURL is inferred instead of explicitly configured
  • expose effective trusted origins from resolved Better Auth context in devtools config API
  • add docs for explicit local siteUrl configuration and a troubleshooting playbook for Invalid origin + provider invalid redirect_uri
  • add/extend tests for runtime config hydration, loopback normalization, and devtools trusted origins visibility

Tests

  • pnpm -s eslint src/module/runtime.ts src/runtime/server/utils/auth.ts src/runtime/server/api/_better-auth/config.get.ts test/get-base-url.test.ts test/runtime-config.test.ts test/module.test.ts
  • pnpm -s tsc --noEmit
  • pnpm -s vitest --run test/runtime-config.test.ts test/get-base-url.test.ts test/no-db.test.ts
  • pnpm -s vitest --run test/module.test.ts (fails in this environment due to missing native package @libsql/linux-x64-gnu during Nitro build)

Related: #101

@pkg-pr-new
Copy link

pkg-pr-new bot commented Feb 11, 2026

Open in StackBlitz

npm i https://pkg.pr.new/nuxt-modules/better-auth/@onmax/nuxt-better-auth@102

commit: b52d324

@onmax onmax merged commit 0467d20 into main Feb 11, 2026
3 checks passed
@onmax onmax deleted the fix/local-oauth-dx-main branch February 12, 2026 05:46
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