Skip to content

feat(auth): add mobile JWT auth, member-scoped /v1 access and /v1/me endpoints - #1621

Merged
realcodesiman merged 5 commits into
mainfrom
feat/mobile-jwt-auth
Nov 4, 2026
Merged

realcodesiman merged 5 commits into
mainfrom
feat/mobile-jwt-auth

Conversation

@realcodesiman

Copy link
Copy Markdown
Contributor

Summary

  • add mobile JWT password-grant authentication and authenticated user endpoints
  • scope public /v1 contacts and conversations to authorized workspace members
  • document the public API surface and cover authentication, rate-limit, and scope behavior

Verification

  • pnpm lint
  • pnpm --filter builder check-types
  • pnpm --filter builder test -- tests/mobile-contacts-member-scope.test.ts tests/mobile-conversations-member-scope.test.ts tests/mobile-jwt-middleware.test.ts tests/mobile-me-api.test.ts tests/mobile-member-allowlist.test.ts tests/mobile-password-grant-rate-limit.test.ts tests/mobile-user-auth-middleware.test.ts tests/flows-public-api.test.ts tests/public-spec-operations.test.ts tests/public-spec-options.test.ts tests/rpc-router-auth-surface.test.ts

@github-actions github-actions Bot added the feature New feature or request label Nov 2, 2026
…endpoints

Native mobile app grants (password, exchange_code, refresh_token) via a
better-auth plugin: short-lived access JWT (audience <builder>/api) signed by
the existing jwt() plugin, opaque rotating refresh tokens stored hashed in the
new MobileRefreshToken table (reuse revokes the family), social-login relay
callback and revoke.

workspaceTokenAuthMidddleware gains a third branch for mobile JWTs that
authenticates the caller as a workspace member. Member principals can reach only
an allowlist of /v1 routes and those routes apply the same contact and
conversation scoping the web app applies; workspace tokens and MCP OAuth are
unchanged.

Adds /v1/me, /v1/me/workspaces, /v1/me/device-tokens, /v1/me/password and
/v1/realtime/connect-token, and an enableInInbox field and filter on flows.list.
@realcodesiman
realcodesiman merged commit 91ec53c into main Nov 4, 2026
14 checks passed
@realcodesiman
realcodesiman deleted the feat/mobile-jwt-auth branch November 4, 2026 04:04
hello-jackytruong referenced this pull request in hello-jackytruong/ChatWorkAI Nov 22, 2026
…endpoints (#1621)

* feat(auth): add mobile JWT auth, member-scoped /v1 access and /v1/me endpoints

Native mobile app grants (password, exchange_code, refresh_token) via a
better-auth plugin: short-lived access JWT (audience <builder>/api) signed by
the existing jwt() plugin, opaque rotating refresh tokens stored hashed in the
new MobileRefreshToken table (reuse revokes the family), social-login relay
callback and revoke.

workspaceTokenAuthMidddleware gains a third branch for mobile JWTs that
authenticates the caller as a workspace member. Member principals can reach only
an allowlist of /v1 routes and those routes apply the same contact and
conversation scoping the web app applies; workspace tokens and MCP OAuth are
unchanged.

Adds /v1/me, /v1/me/workspaces, /v1/me/device-tokens, /v1/me/password and
/v1/realtime/connect-token, and an enableInInbox field and filter on flows.list.

* refactor(auth): centralize mobile resource authorization

* fix(auth): harden mobile jwt authorization

* fix(auth): serialize mobile refresh token families

* fix(auth): defer auth module loading in mobile edge paths
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant