Skip to content

feat(auth): faable auth clients update and the MCP tool for profile fields - #12

Merged
boyander merged 1 commit into
mainfrom
feat/auth-clients-update
Oct 14, 2026
Merged

boyander merged 1 commit into
mainfrom
feat/auth-clients-update

Conversation

@boyander

Copy link
Copy Markdown
Member

Why

Since auth v2.78.0 an app's users can write their own profile fields (auth-js updateProfile), but only the fields declared in the client's profile_fields. Until now they could only be declared with raw Management API calls.

CLI: faable auth clients update <client>

faable auth clients update my-app --add-field profile:enum:student,teacher
faable auth clients update my-app --add-field school:string:120 --remove-field old
faable auth clients update my-app --inherit-fields      # back to the tenant's list
faable auth clients update my-app --add-callback https://app.example.com/cb
  • --name, --description.
  • --add-* / --remove-* for callbacks, logout URLs and web origins. The update route replaces each list whole, so the CLI reads the client and edits the list: adding one URL never drops the others.
  • Profile fields:
    • --add-field key | key:string[:max] | key:enum:a,b,c; re-adding a key replaces it.
    • --remove-field key; removing a key that isn't declared is an error.
    • --fields-json replaces the whole list.
    • --inherit-fields drops the client's own list and uses the tenant's again.
    • Specs are validated before any request.
  • clients get shows the fields, or "inherited from the tenant".

MCP: update_auth_client_fields

A write tool (--writes, auth:write) for the profile fields only, never the client's URLs: an agent that can add a callback can be talked into sending users' tokens somewhere else.

⚠️ On the hosted server it still gets a 403: the tenant token the api mints for auth:write doesn't include update:clients. Widening that is a separate decision, not in this PR.

Tests

  • Unit tests for the field spec parsing and editing.
  • MCP contract test and scope test for the new tool.
  • Full suite: 316 passed.
  • Run against production with a throwaway client in the Staff project, deleted afterwards: add/replace/remove fields and callbacks, error on an undeclared key or a bad spec, inherit.

That run also surfaced faablecloud/auth#61: after --inherit-fields the server answered [] instead of null. Until #61 is deployed the CLI shows "none" there, though the client does inherit.

Also bumps @faable/auth-sdk to ^2.7.105.

… fields

`faable auth clients update <client>` edits a client in place:
- --name, --description;
- --add-/--remove- callback, logout URL and web origin, read-modify-write
  so adding one never drops the others (the route replaces lists whole);
- profile fields (what users may write with auth-js updateProfile):
  --add-field key | key:string[:max] | key:enum:a,b,c (re-adding replaces),
  --remove-field key, --fields-json for the whole list, --inherit-fields
  to drop the client's own list and use the tenant's again.
Specs are validated before any request. `clients get` shows the fields.

MCP: update_auth_client_fields (writes, auth:write) — profile fields only,
never the client's URLs: an agent that could add a callback could be
talked into sending users' tokens somewhere else.

@faable/auth-sdk ^2.7.105 (profile_fields in the client types).
@boyander
boyander merged commit 9b4853f into main Oct 14, 2026
1 check passed
@github-actions

Copy link
Copy Markdown

🎉 This PR is included in version 4.9.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@boyander
boyander deleted the feat/auth-clients-update branch October 14, 2026 12:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

1 participant