Auth plugin gaps for workspace/org configuration
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 5/5
- 预计耗时
- 一周以上
- 新手友好度
- 35/100
- Issue 类型
- 功能
- 描述清晰度
- 基本清楚
- 活跃度
- 停滞
- 技术栈
- typescript
- 领域
- api, authentication, backend
调研方向
Start by tracing the auth plugin routes and configuration for listOrganizations, client errors, invitation verification, and createTeam; the issue does not name source files or tests. The linked PR in the child project provides context for the workspace settings use case. Done means meeting the listed acceptance criteria, including the optional unified workspace endpoint if that scope is chosen.
由索引模型根据 Issue 内容生成。
描述
While building out the org/team workspace settings page in a child project, we ran into several gaps in the auth plugin that either require extra round-trips, force fragile client-side workarounds, or create confusing UX. These are functionalities that the plugin contract doesn't expose (or exposes in a way that is hard to use) for a standard "workspace settings" UX.
Gaps
1. listOrganizations does not include the caller's membership role
The listOrganizations route returns org metadata (id, name, slug, logo, metadata, createdAt) but not the caller's role in each org. To know whether the user is an owner/admin/member of the currently active org in a switcher/settings page, we have to make a separate getActiveMember call.
Requested change: Include the caller's membership record (at minimum role, ideally memberId) in each item returned by listOrganizations.
2. Auth client errors lack machine-readable codes
Better Auth server errors are thrown with well-defined error codes (e.g. EMAIL_VERIFICATION_REQUIRED_FOR_INVITATION), but the client error object the UI receives only reliably contains a human-readable message. This forces string matching like:
error.message.toLowerCase().includes("email verification required")
which is brittle across versions/locales.
Requested change: Expose the server error code (and ideally status) on the error object returned to the client, so callers can branch on error.code === "EMAIL_VERIFICATION_REQUIRED_FOR_INVITATION".
3. No runtime/config toggle for requireEmailVerificationOnInvitation
The auth plugin configures Better Auth's organization plugin with requireEmailVerificationOnInvitation: true. This makes listUserInvitations (and accept/reject invitation actions) fail for SIWN and passkey users, because those auth methods create synthetic emails with emailVerified: false. There is no exposed config to relax this for wallet/passkey-only apps.
Requested change: Make requireEmailVerificationOnInvitation configurable via plugin options, or automatically bypass the requirement for sessions whose email is synthetic/verified-by-wallet.
4. No single "active workspace" endpoint
To render a workspace settings page we currently need:
organization.list()for the org listauth.getActiveMember()for the user's roleauth.getContext()/teamWorkspaceQueryOptionsfor teams and active teamorganization.listUserInvitations()for pending invites
Requested change: Consider a single getWorkspace endpoint that returns the user's organizations, active organization, active member role, teams, active team, and pending invitations in one call.
5. createTeam does not add the creator as a team member
When a user calls auth.createTeam, the team is created but the creator is not added as a member. The context's teams list is built from teamMember rows, so the newly created team does not appear for the creator until they explicitly call addTeamMember with their own userId. The UI currently has to work around this by calling createTeam followed immediately by addTeamMember for the current user.
Requested change: createTeam should automatically add the calling user as a member (owner/admin role) of the new team, or expose a separate createTeamAndJoin convenience route.
Acceptance criteria
-
listOrganizationsincludes caller role per org. - Client error objects expose stable
codeandstatusfields. -
requireEmailVerificationOnInvitationis configurable or bypassed for synthetic SIWN/passkey emails. -
createTeamautomatically adds the creator as a team member (or a convenience route is provided). - (Optional) A unified workspace context endpoint reduces the call graph for settings pages.
Context
- Child project:
nearbuilders.org - Affected route:
/settings/workspace - Related PR: https://github.com/NEARBuilders/nearbuilders.org/pull/308
- 主要语言
- TypeScript
- 星标
- 5
- 派生
- 3
- 平均合并
- 9 小时 20 分钟
- 30 天内合并 PR
- 159
环境准备
- 提供 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
NEARBuilders/everything-dev 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 82/100
NEARBuilders/everything-dev#678 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 77/100
NEARBuilders/everything-dev#628 · 1 条评论 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
NEARBuilders/everything-dev#400 ·
维护者通常 1 天内回复
-
难度 3/5 1-2 天 新手友好度 68/100
NEARBuilders/everything-dev#677 ·
维护者通常 1 天内回复
-
难度 5/5 一周以上 新手友好度 35/100
NEARBuilders/everything-dev#673 ·
维护者通常 1 天内回复
查看 NEARBuilders/everything-dev 的全部 Issue
相似的 Issue
-
check:passed streams:remove
难度 1/5 1 小时以内 新手友好度 62/100
维护者通常 1 天内回复
-
bug needs triage
难度 2/5 1-3 小时 新手友好度 62/100
actions/setup-node#1659 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
vercel-labs/wterm#267 ·
维护者通常 2 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 75/100
microsoft/AI-Engineering-Coach#355 · 1 个 reaction ·
维护者通常 4 天内回复
-
level1 nsoc26
难度 2/5 1-3 小时 新手友好度 70/100
GauravKarakoti/SecureFlow#1501 ·
维护者通常 1 天内回复