Documentation Index
Fetch the complete documentation index at: https://mintlify.com/Kismetkanceled/geniehelper/llms.txt
Use this file to discover all available pages before exploring further.
Overview
Genie Helper uses Directus as its authentication backend. The API supports three authentication strategies:- Directus JWT - User authentication for client-facing endpoints
- Shared Secret - Server-to-server communication (credential encryption)
- Admin Token - Internal privileged operations (never exposed to clients)
Directus JWT Authentication
Login Flow
Clients authenticate via the Directus/auth/login endpoint:
Request:
Using the Token
Include theaccess_token in the Authorization header for all authenticated requests:
Token Validation
Endpoints validate tokens by calling Directus/users/me:
401 Unauthorized.
Token Refresh
When the access token expires (default TTL: 15 minutes), use the refresh token:Shared Secret (X-RBAC-SYNC-SECRET)
Purpose
Server-to-server endpoints that handle sensitive operations (credential encryption/decryption) require a shared secret header instead of user JWT. Endpoints using this method:POST /api/credentials/storePOST /api/credentials/revealPOST /api/credentials/reveal-download-credPOST /api/credentials/get-platform-session
Configuration
Set in.env:
Usage
Validation Logic
Admin Token (DIRECTUS_ADMIN_TOKEN)
Purpose
Some operations require Directus admin privileges but should not require end-users to be admins:- User registration (
/api/register) - Creates users via admin token so public registration doesn’t require open Directus permissions - Credential storage - Writes to
platform_connectionstable via admin token - Queue stats - Reads queue metadata
Configuration
Example - Registration Flow
Fromregister.js:43:
directus_users to have public create permissions.
User Role Resolution
Some endpoints verify admin status by checking the authenticated user’s role:Security Best Practices
Token Storage
Token Storage
- Store tokens in secure, httpOnly cookies or native secure storage
- Never store tokens in localStorage (XSS risk)
- Implement automatic token refresh before expiry
Environment Variables
Environment Variables
- Rotate
RBAC_SYNC_WEBHOOK_SECRETandDIRECTUS_ADMIN_TOKENregularly - Use different secrets for development/staging/production
- Never commit secrets to version control
HTTPS in Production
HTTPS in Production
- Always use HTTPS in production (enable via
ENABLE_HTTPS=true) - Configure SSL certificates (
HTTPS_CERT_PATH,HTTPS_KEY_PATH) - Tokens transmitted over HTTP can be intercepted
Token Validation
Token Validation
- All endpoints validate tokens by calling
/users/me(no local JWT verification) - This ensures revoked tokens are immediately invalid
- Adds latency but improves security
Next Steps
Credentials API
Learn how to encrypt and manage platform credentials
