AU

auth-token-manager

This tool manages MikoPBX REST API v3 authentication by exchanging credentials for a valid access token.

Install

mkdir -p .claude/skills/auth-token-manager && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/2842" && unzip -o skill.zip -d .claude/skills/auth-token-manager && rm skill.zip

Installs to .claude/skills/auth-token-manager

Activation

This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.

Получение валидных JWT Bearer токенов для аутентификации MikoPBX REST API v3. Использовать когда нужно тестировать API эндпоинты, отлаживать проблемы аутентификации или при возникновении ошибок 401 Unauthorized. Автоматически обрабатывает вход с username/password и возвращает готовый к использованию access token.
314 charsno explicit “when” triggerlonger than Claude Code's old 250-char listing cap (fine on current versions)
Beginner

Key capabilities

  • Acquire JWT Bearer tokens from MikoPBX API
  • Manage token refresh cycles automatically
  • Handle 401 Unauthorized errors
  • Maintain cookie-based refresh sessions

How it works

It executes an auth workflow that trades credentials for a JWT/cookie pair and handles refresh logic to maintain session state.

Inputs & outputs

You give it
POST /auth:login with credentials
You get back
Valid JWT access token and refresh cookie

When to use auth-token-manager

  • Fixing 401 Unauthorized errors in API calls
  • Generating fresh tokens for testing endpoints
  • Managing token refresh cycles

About this skill

MikoPBX Authentication Token Manager

Overview

This skill provides reliable JWT Bearer token acquisition for MikoPBX REST API v3. Solves the persistent problem of getting valid authentication tokens for API testing and development.

Authentication Architecture

MikoPBX uses dual-token authentication:

  1. Access Token (JWT)

    • Type: JSON Web Token
    • Lifetime: 15 minutes (900 seconds)
    • Storage: In-memory (Authorization: Bearer header)
    • Purpose: Stateless API authorization
  2. Refresh Token

    • Type: Random hex string
    • Lifetime: 30 days (configurable via rememberMe)
    • Storage: httpOnly cookie + Redis
    • Purpose: Token rotation without re-authentication

Token Workflow

┌─────────────┐
│   Login     │ POST /auth:login
│  username   │ {login, password, rememberMe}
│  password   │
└──────┬──────┘
       │
       ▼
┌─────────────────────────────────┐
│  Server Response                │
│  - accessToken (JWT, 15 min)   │
│  - refreshToken (cookie, 30d)  │
└──────┬──────────────────────────┘
       │
       ▼
┌─────────────────────────────────┐
│  API Request                    │
│  Authorization: Bearer <JWT>   │
│  Cookie: refreshToken=xxx       │
└──────┬──────────────────────────┘
       │
       ▼ (when token expires)
┌─────────────────────────────────┐
│  Refresh                        │
│  POST /auth:refresh             │
│  Cookie: refreshToken=xxx       │
└──────┬──────────────────────────┘
       │
       ▼
┌─────────────────────────────────┐
│  New Tokens                     │
│  - new accessToken (JWT)        │
│  - new refreshToken (rotated)   │
└─────────────────────────────────┘

Features

  • ✅ Automatic JWT token acquisition via username/password
  • ✅ Cookie-based session management (for refresh tokens)
  • ✅ Token validation and expiration checking
  • ✅ Support for both HTTP and HTTPS endpoints
  • ✅ Configurable timeout and retry logic
  • ✅ Clear error messages for debugging

Environment Variables

The skill uses these environment variables (with defaults):

MIKOPBX_API_URL="http://mikopbx-php83.localhost:8081/pbxcore/api/v3"  # API base URL
MIKOPBX_LOGIN="admin"                                    # Username
MIKOPBX_PASSWORD="123456789MikoPBX#1"                   # Password

For HTTPS with self-signed certificates:

MIKOPBX_API_URL="https://localhost:8445/pbxcore/api/v3"

Usage Examples

Example 1: Get Token for API Testing

# Get fresh token
TOKEN=$(bash .claude/skills/auth-token-manager/get-auth-token.sh)

# Use token in API requests
curl -H "Authorization: Bearer $TOKEN" \
     http://mikopbx-php83.localhost:8081/pbxcore/api/v3/extensions

Example 2: Custom Credentials

# Override default credentials
export MIKOPBX_LOGIN="custom_admin"
export MIKOPBX_PASSWORD="custom_password"
TOKEN=$(bash .claude/skills/auth-token-manager/get-auth-token.sh)

Example 3: HTTPS with Self-Signed Certificate

# For local development with self-signed cert
export MIKOPBX_API_URL="https://192.168.117.2:8445/pbxcore/api/v3"
TOKEN=$(bash .claude/skills/auth-token-manager/get-auth-token.sh)

Example 4: Debug Mode

# See full request/response
bash .claude/skills/auth-token-manager/get-auth-token.sh --debug

Token Format

Valid JWT tokens have 3 parts separated by dots:

eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VySWQiOiJhZG1pbiIsInJvbGUiOiJhZG1pbnMiLCJsYW5ndWFnZSI6InJ1IiwiaWF0IjoxNzYwODg4Mjc2LCJleHAiOjE3NjA4ODkxNzYsIm5iZiI6MTc2MDg4ODI3Nn0.SOP3FAXD-O56m7e-l2-aq5rJ02OZB6UtBACbRy4aNKg

Parts:

  1. Header: Algorithm and token type
  2. Payload: User ID, role, language, timestamps (iat, exp, nbf)
  3. Signature: HMAC-SHA256 signature

Common Issues

Issue 1: "Connection refused"

Cause: MikoPBX container not running Solution: Start container or check MIKOPBX_API_URL

Issue 2: "Invalid credentials"

Cause: Wrong username/password Solution: Verify MIKOPBX_LOGIN and MIKOPBX_PASSWORD

Issue 3: "SSL certificate problem"

Cause: Self-signed certificate without --insecure Solution: Script automatically handles this for HTTPS URLs

Issue 4: "Token expired"

Cause: Token older than 15 minutes Solution: Get fresh token (this skill does it automatically)

Technical Details

Login Endpoint

POST /pbxcore/api/v3/auth:login
Content-Type: application/x-www-form-urlencoded

login=admin&password=123456789MikoPBX%231&rememberMe=false

Response Format

{
  "result": true,
  "data": {
    "accessToken": "eyJ0eXAiOiJKV1QiLCJh...",
    "tokenType": "Bearer",
    "expiresIn": 900
  },
  "messages": {}
}

Security Notes

  1. HTTPS Recommended: Always use HTTPS in production
  2. Token Storage: Never commit tokens to git
  3. Token Lifetime: Tokens expire after 15 minutes
  4. Refresh Token: Stored in httpOnly cookie (XSS protection)
  5. Session Management: Each login creates new session

Integration with Other Skills

This skill can be used by:

  • mikopbx-api-test-generating - Get tokens for pytest tests
  • rest-api-docker-tester - Get tokens for CURL tests
  • Custom testing scripts

Files

  • get-auth-token.sh - Main script for token acquisition
  • SKILL.md - This documentation
  • README.md - Quick reference guide

See Also

When not to use it

  • Authentication systems other than MikoPBX v3
  • Environments where security tokens can be hardcoded

Prerequisites

MikoPBX username and password

Limitations

  • JWT expires every 15 minutes
  • Requires active connection to MikoPBX server

How it compares

It manages specific MikoPBX dual-token authentication patterns rather than implementing general-purpose OAuth2 flows.

Compared to similar skills

auth-token-manager side by side with the closest alternatives in the catalog.

SkillInstallsUpdatedSafetyDifficulty
auth-token-manager (this skill)19moReviewBeginner
openevidence-security-basics027dReviewIntermediate
sts0No flagsAdvanced
twilio-communications36moReviewIntermediate

Try saying

Example prompts that trigger this skill in your AI assistant.

sqlite-inspector

mikopbx

Проверка консистентности данных в SQLite баз данных MikoPBX после операций REST API. Использовать при валидации результатов API, отладке проблем с данными, проверке связей внешних ключей или инспектировании CDR записей для тестирования.

568

log-analyzer

mikopbx

Анализ логов Docker контейнера для диагностики проблем и мониторинга здоровья системы. Использовать при отладке ошибок, отслеживании процессов воркеров, исследовании проблем API или мониторинге поведения системы после тестов.

213

openapi-analyzer

mikopbx

Извлечение и анализ OpenAPI 3.1.0 спецификации из MikoPBX для валидации эндпоинтов. Использовать при проверке соответствия API, генерации тестов, проверке схем эндпоинтов или интеграции с навыками endpoint-validator и api-test-generator.

25

api-test-generator

mikopbx

Генерация полных Python pytest тестов для REST API эндпоинтов с валидацией схемы. Использовать при создании тестов для новых эндпоинтов, добавлении покрытия для CRUD операций или валидации соответствия API с OpenAPI схемами.

16

asterisk-tester

mikopbx

Тестирование сценариев Asterisk dialplan и потоков звонков используя безопасные Local каналы. Использовать при тестировании логики маршрутизации звонков, отладке проблем dialplan или проверке потоков IVR меню.

11

asterisk-validator

mikopbx

Валидация конфигурационных файлов Asterisk и анализ логов на корректность и best practices. Использовать при отладке проблем запуска Asterisk, проверке изменений конфигурации или проверке ошибок после регенерации воркерами.

13

You might also like

openevidence-security-basics

jeremylongshore

Apply OpenEvidence security best practices for HIPAA compliance and PHI protection. Use when securing API keys, implementing PHI handling, or auditing OpenEvidence security configuration. Trigger with phrases like "openevidence security", "openevidence hipaa", "openevidence phi", "secure openevidence", "openevidence compliance".

00

sts

ArtisanCloud

PowerX STS 与插件鉴权规范(Exchange、KeyRing、拦截器、审计)。

00

twilio-communications

davila7

Build communication features with Twilio: SMS messaging, voice calls, WhatsApp Business API, and user verification (2FA). Covers the full spectrum from simple notifications to complex IVR systems and multi-channel authentication. Critical focus on compliance, rate limits, and error handling. Use when: twilio, send SMS, text message, voice call, phone verification.

324

lindy-install-auth

jeremylongshore

Install and configure Lindy AI SDK/CLI authentication. Use when setting up a new Lindy integration, configuring API keys, or initializing Lindy in your project. Trigger with phrases like "install lindy", "setup lindy", "lindy auth", "configure lindy API key".

410

clay-install-auth

jeremylongshore

Install and configure Clay SDK/CLI authentication. Use when setting up a new Clay integration, configuring API keys, or initializing Clay in your project. Trigger with phrases like "install clay", "setup clay", "clay auth", "configure clay API key".

06

evernote-install-auth

jeremylongshore

Install and configure Evernote SDK and OAuth authentication. Use when setting up a new Evernote integration, configuring API keys, or initializing Evernote in your project. Trigger with phrases like "install evernote", "setup evernote", "evernote auth", "configure evernote API", "evernote oauth".

14

Search skills

Search the agent skills registry