Skip to content

feat: bridge Better Auth UI to BTST v3 providers - #19

Merged
olliethedev merged 1 commit into
mainfrom
feat/issue-17-v3-provider-contracts
Aug 22, 2026
Merged

feat: bridge Better Auth UI to BTST v3 providers#19
olliethedev merged 1 commit into
mainfrom
feat/issue-17-v3-provider-contracts

Conversation

@olliethedev

Copy link
Copy Markdown
Collaborator

Summary

  • add client and server Better Auth adapters for the BTST v3 auth contracts
  • source router, notifications, localization, identity refresh, and explicit permission checks from top-level StackProvider services
  • keep the fork delta isolated to bridge/adapter/plugin surfaces so upstream component updates remain easy to sync
  • add BTST v3 integration documentation and a retry-safe RC publishing workflow

Security behavior

  • Better Auth's native permission hook is preserved unless permissionProvider or a custom can mapping is explicitly configured
  • anonymous mapped permission checks fail closed
  • permission batches that BTST's single resource/action contract cannot represent fail closed
  • session changes refetch BTST identity before refreshing the router

Scope

The upstream standalone AuthUIProvider and auth/account/organization UI components are unchanged. createResource, useForm, and useListState are not introduced because Better Auth already owns these form/query flows and there is no corresponding BTST resource/list seam to adapt.

Verification

  • pnpm test (65 tests)
  • pnpm build
  • pnpm lint (pre-existing warnings only)
  • cd docs && pnpm build (68 static pages)
  • built root, /client, and /server declarations expose the intended provider factories

Closes #17

@olliethedev
olliethedev merged commit 9cc5586 into main Aug 22, 2026
1 check passed
@olliethedev
olliethedev deleted the feat/issue-17-v3-provider-contracts branch August 22, 2026 17:57

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8b29096deb

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +81 to +84
body: getPermissionBody(
params,
permissionProvider === "organization"
)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Include the identity in server admin permission checks

When permissionProvider is "admin", Better Auth's server-side userHasPermission API needs the user being checked (normally userId: params.identity.id, or an explicit role) in the request body. This call only sends permissions, despite already requiring params.identity, so documented server configurations using the admin provider will have their authorization checks rejected or fail closed rather than evaluate that user's permissions.

Useful? React with 👍 / 👎.

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.

Migrate to @btst/stack 3.0.0 (yar v3 routes, provider contracts, legacy override removal)

1 participant