clerk-token-ops

Automate Clerk JWT token generation, validation, and export for FastAPI integration tests.

1|Updated Jul 22, 2025
One-click install
npx skills add https://github.com/Danik911/thesis_project --skill clerk-token-ops
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: clerk-token-ops
Source: https://github.com/Danik911/thesis_project/tree/main/.claude/skills/clerk-token-ops
Command: npx skills add https://github.com/Danik911/thesis_project --skill clerk-token-ops

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Automates Clerk JWT token generation, validation, and export for FastAPI integration tests, enabling token refreshes and template verification without altering environment state.

Core Features & Use Cases

  • Token minting: Create fresh Clerk session tokens for test scenarios.
  • Export tokens: Persist tokens to environment variables or files for automated tests.
  • Template validation: Verify Clerk token templates and ensure environment sync.

Quick Start

Generate a fresh Clerk session token for a test user and export it to the environment as CLERK_TOKEN.

Frequently Asked Questions about clerk-token-ops

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

FAQPage Schema
How do I generate Clerk JWT tokens for FastAPI integration tests?▼

Generate Clerk JWT tokens by running get_clerk_token.py with your CLERK_SECRET_KEY and token template. The script mints RS256-signed server-token JWTs with ~60-second lifespans, exports them as CLERK_TOKEN environment variables, and validates token structure before use in FastAPI test scenarios.

What do I need to set up before generating and validating Clerk tokens?▼

Ensure environment synchronization by configuring CLERK_SECRET_KEY, CLERK_ISSUER, and CLERK_PEM_PUBLIC_KEY in .env.local. Verify your Clerk token template uses RS256 signing and server-token type. These prerequisites enable token generation, validation, and audit verification (token_iat, sub fields) across test environments.

Can I use Clerk token generation to troubleshoot 401 authentication errors in tests?▼

Yes. 401 errors often stem from expired or malformed tokens. Generate fresh Clerk tokens with validated templates and explicit CLERK_TOKEN export, then re-run tests. The Skill verifies token structure, signature, and environment sync to isolate authentication failures from token lifecycle issues.

How do I keep Clerk tokens synchronized across .env.local and PowerShell sessions?▼

Use Set-ClerkToken.ps1 to export generated tokens to PowerShell sessions while maintaining .env.local state. The script enforces environment variable sync for CLERK_SECRET_KEY and CLERK_TOKEN, preventing mismatches between local configuration and session context during test execution.

What are the limitations when working with Clerk token templates?▼

Clerk token templates must use RS256 signing and server-token type; other algorithms or template types are not supported. Tokens have ~60-second lifespans by design. Environment variables (CLERK_SECRET_KEY, CLERK_ISSUER, CLERK_PEM_PUBLIC_KEY) must be valid and synchronized; misconfigurations prevent token generation and validation.