Получение валидных JWT Bearer токенов для аутентификации MikoPBX REST API v3...
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.
MikoPBX uses dual-token authentication:
Access Token (JWT)
Refresh Token
┌─────────────┐
│ 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) │
└─────────────────────────────────┘
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"
# 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
# Override default credentials
export MIKOPBX_LOGIN="custom_admin"
export MIKOPBX_PASSWORD="custom_password"
TOKEN=$(bash .claude/skills/auth-token-manager/get-auth-token.sh)
# 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)
# See full request/response
bash .claude/skills/auth-token-manager/get-auth-token.sh --debug
Valid JWT tokens have 3 parts separated by dots:
eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VySWQiOiJhZG1pbiIsInJvbGUiOiJhZG1pbnMiLCJsYW5ndWFnZSI6InJ1IiwiaWF0IjoxNzYwODg4Mjc2LCJleHAiOjE3NjA4ODkxNzYsIm5iZiI6MTc2MDg4ODI3Nn0.SOP3FAXD-O56m7e-l2-aq5rJ02OZB6UtBACbRy4aNKg
Parts:
Cause: MikoPBX container not running
Solution: Start container or check MIKOPBX_API_URL
Cause: Wrong username/password
Solution: Verify MIKOPBX_LOGIN and MIKOPBX_PASSWORD
Cause: Self-signed certificate without --insecure Solution: Script automatically handles this for HTTPS URLs
Cause: Token older than 15 minutes Solution: Get fresh token (this skill does it automatically)
POST /pbxcore/api/v3/auth:login
Content-Type: application/x-www-form-urlencoded
login=admin&password=123456789MikoPBX%231&rememberMe=false
{
"result": true,
"data": {
"accessToken": "eyJ0eXAiOiJKV1QiLCJh...",
"tokenType": "Bearer",
"expiresIn": 900
},
"messages": {}
}
This skill can be used by:
mikopbx-api-test-generating - Get tokens for pytest testsrest-api-docker-tester - Get tokens for CURL testsget-auth-token.sh - Main script for token acquisitionSKILL.md - This documentationREADME.md - Quick reference guide