jac-cl-auth

Implements client-side signup, login, logout, and route protection in Jac applications.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Client-side authentication in Jac has subtle failure modes: jacSignup returns a dict while jacLogin returns a bool, signup alone never establishes a session, and missing awaits or tight variable scoping cause silent runtime errors that pass compilation. This Skill encodes the correct call order, return types, and guard patterns so auth code works on the first try. ## Core Features & Use Cases - Correct helper usage: Documents the exact return types of jacSignup (dict), jacLogin (bool), jacLogout (sync), and jacIsLoggedIn (sync) from @jac/runtime, with the pre-declaration pattern that avoids ReferenceError at runtime. - Signup-then-login flow: Enforces the mandatory three-step awaited sequence (jacSignup, jacLogin, then def:priv calls) so protected endpoints receive an authenticated session. - Route protection: Shows AuthGuard layout patterns for file-based route groups plus inline jacIsLoggedIn guards, and SSO login via jacSsoLogin with server-side provider configuration. - Use Case: When building a registration page that also saves a user profile via a def:priv endpoint, apply this Skill to order the awaits correctly and avoid the 401 Unauthorized that appears only at runtime. ## Quick Start Add a login and signup flow to my Jac app with an AuthGuard protecting the dashboard route.

Frequently Asked Questions about jac-cl-auth

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

FAQPage Schema
How do I implement login and signup in a Jac client app?▼

Import jacLogin and jacSignup from @jac/runtime and await both in order. jacSignup returns a dict with a success key, while jacLogin returns a bool, so check signup_result["success"] and the login boolean separately.

How do I protect routes from unauthenticated users in Jac?▼

Wrap protected pages in the AuthGuard component from @jac/runtime with a redirect prop, typically in a layout file for a route group. For one-off cases, use an inline jacIsLoggedIn() check returning a Navigate component.

Why does my Jac app return 401 after signup when calling a protected endpoint?▼

jacSignup creates the account but does not establish a session. You must await jacLogin with the same credentials before any def:priv call, otherwise the request reaches the server without the session cookie and returns 401 Unauthorized.

Why does checking a jacSignup result with if not always fail?▼

jacSignup returns a dict shaped {"success": bool, ...} which is always truthy, so if not signup_result never detects failure. Check the success key explicitly with if not signup_result["success"].

Does Jac support SSO login with Google?▼

Yes. Configure the provider under [scale.sso.google] in jac.toml on the server, then call await jacSsoLogin("google") on the client, which returns a bool once the token lands. Callback pages can use jacSetToken to store a token directly.

Why is my awaited variable undefined at the if-check in client Jac?▼

In client Jac, var = await fn() can compile to a tightly scoped JS let, causing ReferenceError at the later if-check. Pre-declare the variable with a type and default at the top of the function, then assign the awaited result.