Skip to content

feat(server): enable email/password auth (+ login docs)#93

Merged
os-zhuang merged 1 commit into
mainfrom
feat/server-auth
Jun 10, 2026
Merged

feat(server): enable email/password auth (+ login docs)#93
os-zhuang merged 1 commit into
mainfrom
feat/server-auth

Conversation

@os-zhuang

Copy link
Copy Markdown
Contributor

What

Mounts @objectstack/plugin-auth at /api/v1/auth/* — the base path the mobile authClient already targets — so sign-in / sign-up actually work against the local server (previously every /api/v1/auth/* route 404'd).

  • AuthPlugin with emailAndPassword enabled, identity tables on the default datasource, OS_AUTH_SECRET (dev fallback for local), trustedOrigins for the local web origin.
  • README documents auth, that pnpm dev auto-provisions the SQLite datasource backing identity + data (serve has none by default), and the better-sqlite3 native-build gotcha (pnpm rebuild better-sqlite3 if the binding is missing).

Verified end-to-end (local)

  1. sign-up / sign-in200 + better-auth.session_token cookie.
  2. Authenticated server_item create → 201, query returns the rows.
  3. AI Assistant with the session answers over real data: "There are a total of 2 server items. Their names are: 1. Widget A 2. Gadget B".

This closes the loop on the mobile login → data → AI flow: once a user is signed in, the assistant queries their real records (the app carries the session via apiFetch).

Notes

  • Root cause of the earlier 500s was the uncompiled better-sqlite3 binding (the recurring pnpm build-script gate), not the auth config.
  • The dev-only secret is a local fallback; set OS_AUTH_SECRET in any real deploy.

🤖 Generated with Claude Code

Mounts @objectstack/plugin-auth at /api/v1/auth/* (the base path the
mobile authClient already targets), so sign-in/sign-up actually work
against the local server.

- AuthPlugin with emailAndPassword enabled, identity tables on the
  `default` datasource, OS_AUTH_SECRET (dev fallback), trustedOrigins for
  the local web origin.
- README documents auth, that `pnpm dev` auto-provisions the SQLite
  datasource that backs identity + data (serve has none by default), and
  the better-sqlite3 native-build gotcha.

Verified the full chain locally: sign-up/sign-in → 200 + session cookie,
authenticated server_item create (201) + query, and the AI Assistant
answering over real data with the session ("There are 2 server items:
Widget A, Gadget B"). This confirms the mobile login + data + AI flow
end to end once a user is signed in.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@os-zhuang os-zhuang merged commit 9c42471 into main Jun 10, 2026
1 of 4 checks passed
@os-zhuang os-zhuang deleted the feat/server-auth branch June 10, 2026 06:55
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