jac-sv-auth

Explains Jac server-side authentication semantics for JWT, roles, and endpoint visibility.

Updated Jul 26, 2026
One-click install
npx skills add https://github.com/nihalnihalani/jachacks-sf-2026 --skill jac-sv-auth-nihalnihalani
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: jac-sv-auth
Source: https://github.com/nihalnihalani/jachacks-sf-2026/tree/main/plugins/jac-codex/skills/jac-sv-auth
Command: npx skills add https://github.com/nihalnihalani/jachacks-sf-2026 --skill jac-sv-auth-nihalnihalani

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Choosing the wrong endpoint visibility in Jac silently leaks per-user data or breaks authentication, and the differences between def:pub, def:priv, and def:protect are easy to misunderstand. This Skill provides the canonical, server-verified statement of Jac's auth model so you decide correctly which endpoints need login and whose data they see. ## Core Features & Use Cases - Endpoint auth semantics: Canonical rules for def:pub, plain def, def:priv, and def:protect, including how root resolves differently for anonymous versus token-bearing callers. - REST auth flow: Exact register/login request shapes (identity arrays, credential objects), token usage, refresh, and role management via the admin API. - Production hardening guidance: JWT secret configuration, role system behavior, and pitfalls like register returning no token or grant() not being per-user. - Use Case: When adding a new endpoint that reads a user's todos, use this Skill to confirm it must be a plain def or def:priv so it runs on the caller's isolated root rather than the shared guest graph. ## Quick Start Ask the agent to review your Jac server endpoints and confirm which ones require JWT authentication and which run on the shared guest graph.

Frequently Asked Questions about jac-sv-auth

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I require login for a Jac server endpoint?▼

Use a plain def or def:priv declaration, which both require a JWT and run on the caller's own isolated root. Only def:pub skips authentication, and def:protect behaves identically to def:priv for auth purposes.

What is the difference between def:pub, def:priv, and def:protect in Jac?▼

def:pub allows anonymous access on a shared guest graph, while def:priv and plain def require JWT and run per-user. def:protect requires JWT too; its pub/protect/priv gradient controls source visibility, not authentication strength.

How do I register and log in a user via the Jac REST API?▼

POST to /user/register with an identities array and credential object, then POST to /user/login with a single identity and credential to receive a token. Registration returns 201 with no token, so always call login afterward.

Why does my Jac endpoint return 401 UNAUTHORIZED?▼

The endpoint is declared as plain def, def:priv, or def:protect and the request lacks a valid Bearer token. Do not fix this by switching to def:pub, since that changes which graph the endpoint runs on, not just who may call it.

Does Jac support user roles and admin permissions?▼

Yes, Jac has built-in admin, system, and user roles stored on the user and carried in JWT claims. Set roles via the admin API or /admin portal; for app-domain roles, store a role field on a node under the user's root.

What is the JWT secret risk in Jac production deployments?▼

The default signing secret is a publicly known testing value, so anyone can forge tokens for any user. Set a real secret via [scale.jwt] config or the JWT_SECRET environment variable before deploying.