mx-core-local-auth

Creates short-lived owner sessions in the local PostgreSQL database for verification.

556|154|Updated Jul 14, 2021
One-click install
npx skills add https://github.com/mx-space/core --skill mx-core-local-auth
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: mx-core-local-auth
Source: https://github.com/mx-space/core/tree/main/.claude/skills/mx-core-local-auth
Command: npx skills add https://github.com/mx-space/core --skill mx-core-local-auth

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

When verifying UI or API behavior in a local mx-core development environment, protected routes return login gates, redirects, 401 errors, or AUTH_NOT_LOGGED_IN responses that block testing. This Skill creates a temporary owner session directly in the local database so verification can proceed without manual login flows.

Core Features & Use Cases

  • On-demand session creation: Inserts a short-lived (max 15 minute) owner session into the local PostgreSQL sessions table using the configured PG_URL, without modifying readers, accounts, passwords, or API keys.
  • Dual-channel reuse: Supports API verification via an Authorization Bearer token and browser UI verification via an HMAC-SHA256 signed better-auth session cookie.
  • Guaranteed cleanup: Deletes the temporary session by both ID and token in a finally-style cleanup, even when verification fails.
  • Use Case: While testing a protected admin endpoint locally, you hit a 401 response. Use this Skill to mint a temporary owner session, retry the exact operation with the Bearer token, collect evidence, and remove the session afterward.

Quick Start

Create a temporary local owner session so I can verify this protected API endpoint that returned a 401, then clean it up afterward.

Frequently Asked Questions about mx-core-local-auth

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

FAQPage Schema
How do I test protected API endpoints locally without logging in?

Insert a short-lived owner session directly into the local PostgreSQL sessions table, then send its token as an Authorization Bearer header. The Better Auth bearer plugin resolves the token to the database session automatically.

How do I authenticate in browser UI tests for mx-core locally?

Sign the session token with the local JWT_SECRET using HMAC-SHA256 and standard Base64, then set the better-auth.session_token cookie as token.signature in the browser context. URL-encode the value when writing a raw Cookie header.

Can I use this local session workflow on staging or production?

No. This workflow is strictly forbidden for staging, production, shared databases, or any database whose local ownership is uncertain. It is designed only for the local development database configured via PG_URL.

Why does my local API request still return 401 after creating a session?

Check that the session token contains no period character, that it was inserted for an owner-role reader, and that you are sending the raw token as a Bearer header. Also note local development routes have no /api/v1 prefix.

What happens to the temporary session after verification finishes?

The session row is deleted by both ID and token in a finally-style cleanup, even if verification fails. Sessions also expire automatically within at most 15 minutes of creation.