Skip to content

Add @wasp.sh/auth-clerk and @wasp.sh/auth-better-auth adapter packages and switch the examples to them - #4730

Draft
FranjoMindek wants to merge 1 commit into
franjo/auth2-client-adapterfrom
franjo/auth2-7-adapter-packages
Draft

Add @wasp.sh/auth-clerk and @wasp.sh/auth-better-auth adapter packages and switch the examples to them#4730
FranjoMindek wants to merge 1 commit into
franjo/auth2-client-adapterfrom
franjo/auth2-7-adapter-packages

Conversation

@FranjoMindek

Copy link
Copy Markdown
Contributor

Description

Stack 7/7. The payoff: two real adapter packages, and the example apps switch to them.

  • examples/auth-providers/packages/auth-clerk and auth-better-auth: /spec entries are zero-import manifest helpers (clerk(), betterAuth()), /server entries implement createServerAdapter, Clerk's /client ships ClerkAuthProvider + useClerkWaspSessionBridge as plain React exports. Committed dist/ exists for the file: deps — skip it in review, along with lockfiles and the golden dir.
  • The clerk app's server-side integration collapses to provider: clerk(); its client side is a 5-line composition in App.tsx. The better-auth app drops its hand-declared routes for the manifest's routes (mounted at /better-auth, raw body), gains setup.ts via setupFn (default-or-explicit semantics), and keeps only its Prisma models — a manifest cannot contribute schema.
  • custom-clerk is untouched: diffing it against clerk now shows exactly what an adapter package absorbs (~80 lines of adapter + client bridge → one spec helper call).
  • E2E: AuthProviderExternalSnapshotTest snapshots the packaged Clerk app — the golden proof that an external-provider app generates no auth forms, no lucia/jwt/password modules, no JWT_SECRET requirement, and does get the identity module and the manifest's env vars in its env schemas.

With this, the whole stack's thesis is on the table: adopting an external provider costs an app a one-line spec helper plus its login page, and context.user never changes meaning.

Type of change

  • 🔧 Just code/docs improvement
  • 🐞 Bug fix
  • 🚀 New/improved feature
  • 💥 Breaking change

Checklist

  • I tested my change in a Wasp app to verify that it works as intended.

  • 🧪 Tests and apps:

    • I added unit tests for my change.
    • (if you fixed a bug) I added a regression test for the bug I fixed.
    • (if you added/updated a feature) I added/updated e2e tests in examples/kitchen-sink/e2e-tests.
    • (if you added/updated a feature) I updated the starter templates in waspc/data/Cli/templates, as needed.
    • (if you added/updated a feature) I updated the example apps in examples/, as needed.
      • (if you updated examples/tutorials) I updated the tutorial in the docs (and vice versa).
  • 📜 Documentation:

    • (if you added/updated a feature) I added/updated the documentation in web/docs/.
  • 🆕 Changelog: (if change is more than just code/docs improvement)

    • I updated waspc/ChangeLog.md with a user-friendly description of the change.
    • (if you did a breaking change) I added a step to the current migration guide in web/docs/migration-guides/.
    • I bumped the version in waspc/waspc.cabal to reflect the changes I introduced.

@pkg-pr-new

pkg-pr-new Bot commented Aug 14, 2026

Copy link
Copy Markdown

Open in StackBlitz

@wasp.sh/spec

npx https://pkg.pr.new/wasp-lang/wasp/@wasp.sh/spec@4730

@wasp.sh/wasp-cli

npx https://pkg.pr.new/wasp-lang/wasp/@wasp.sh/wasp-cli@4730

@wasp.sh/wasp-cli-darwin-arm64-unknown

npx https://pkg.pr.new/wasp-lang/wasp/@wasp.sh/wasp-cli-darwin-arm64-unknown@4730

@wasp.sh/wasp-cli-darwin-x64-unknown

npx https://pkg.pr.new/wasp-lang/wasp/@wasp.sh/wasp-cli-darwin-x64-unknown@4730

@wasp.sh/wasp-cli-linux-arm64-glibc

npx https://pkg.pr.new/wasp-lang/wasp/@wasp.sh/wasp-cli-linux-arm64-glibc@4730

@wasp.sh/wasp-cli-linux-x64-glibc

npx https://pkg.pr.new/wasp-lang/wasp/@wasp.sh/wasp-cli-linux-x64-glibc@4730

@wasp.sh/wasp-cli-linux-x64-musl

npx https://pkg.pr.new/wasp-lang/wasp/@wasp.sh/wasp-cli-linux-x64-musl@4730

commit: 93ee5d2

@FranjoMindek
FranjoMindek force-pushed the franjo/auth2-7-adapter-packages branch from d2fcbd5 to 7574f24 Compare August 14, 2026 19:16
@FranjoMindek

Copy link
Copy Markdown
Contributor Author

Both adapter packages updated for the #4725 contract refactors: clerk() and betterAuth() produce external:-prefixed ids, both server adapters return the tagged AuthenticateResult, dists rebuilt, and the external snapshot golden regenerated with the new provenance.

@FranjoMindek
FranjoMindek deployed to fly-deploy-test August 14, 2026 20:15 — with GitHub Actions Active
@FranjoMindek
FranjoMindek force-pushed the franjo/auth2-7-adapter-packages branch from 7574f24 to ac5ca2d Compare August 14, 2026 21:57
@FranjoMindek

Copy link
Copy Markdown
Contributor Author

Both package adapters now annotate their providers as SessionRevokingAuthProvider explicitly (hoisted typed consts), matching the optional-revocation contract from #4725. The clerk README's interface snippet teaches the three-interface shape.

@FranjoMindek
FranjoMindek deployed to fly-deploy-test August 14, 2026 23:19 — with GitHub Actions Active
@FranjoMindek
FranjoMindek force-pushed the franjo/auth2-7-adapter-packages branch from ac5ca2d to b798be7 Compare August 15, 2026 08:28
@FranjoMindek
FranjoMindek force-pushed the franjo/auth2-7-adapter-packages branch from b798be7 to 3827d37 Compare August 15, 2026 09:40
@FranjoMindek

Copy link
Copy Markdown
Contributor Author

Adapters now annotate by intersection (AuthProvider & SupportsSessionRevocation), and the clerk README teaches the composition model with per-provider examples. Dists rebuilt.

@FranjoMindek
FranjoMindek deployed to fly-deploy-test August 15, 2026 10:17 — with GitHub Actions Active
@FranjoMindek
FranjoMindek force-pushed the franjo/auth2-7-adapter-packages branch from 3827d37 to e728351 Compare August 15, 2026 14:43
@FranjoMindek
FranjoMindek deployed to fly-deploy-test August 15, 2026 15:24 — with GitHub Actions Active
@FranjoMindek
FranjoMindek force-pushed the franjo/auth2-7-adapter-packages branch from e728351 to 93ee5d2 Compare August 15, 2026 16:18
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Aug 15, 2026

Copy link
Copy Markdown

Deploying wasp-docs-on-main with  Cloudflare Pages  Cloudflare Pages

Latest commit: 93ee5d2
Status: ✅  Deploy successful!
Preview URL: https://c13e97e0.wasp-docs-on-main.pages.dev
Branch Preview URL: https://franjo-auth2-7-adapter-packa.wasp-docs-on-main.pages.dev

View logs

@FranjoMindek

Copy link
Copy Markdown
Contributor Author

Rebased onto the new client-adapter PR (#4732). The Clerk package now implements createClientAdapter (ClerkProvider as Wrapper, pull-based getToken, Clerk's listener and signOut for the hooks, publishable key via the manifest's client env), and the clerk example collapses accordingly: no App.tsx, no env.ts, no client block in the spec — provider: clerk() plus a login page is the entire app footprint. custom-clerk deliberately keeps manual client wiring as the escape-hatch contrast.

@FranjoMindek
FranjoMindek changed the base branch from franjo/auth2-6-adapter-codegen to franjo/auth2-client-adapter August 15, 2026 16:20
@FranjoMindek
FranjoMindek deployed to fly-deploy-test August 15, 2026 16:54 — with GitHub Actions Active
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