Skip to main content

Overview

Pterodactyl Wings uses two authentication mechanisms:
  1. Bearer Token Authentication - For Panel-to-Wings API communication
  2. JWT (JSON Web Tokens) - For temporary access to specific resources
Wings is designed to receive requests from the Pterodactyl Panel backend only. Direct client access is not supported for Bearer token endpoints.

Bearer Token Authentication

How It Works

Most Wings API endpoints require a static Bearer token that matches the token configured in the Wings config.yml file. This token is shared between the Panel and Wings during initial setup.

Configuration

The authentication token is stored in /etc/pterodactyl/config.yml:
The token_id is a unique identifier for the node, while token is the actual authentication credential.

Making Authenticated Requests

Include the Bearer token in the Authorization header:

Authorization Header Format

Authentication Flow

When a request is received, Wings:
  1. Extracts the Authorization header
  2. Splits the header on the first space character
  3. Verifies the prefix is exactly Bearer
  4. Compares the token using constant-time comparison to prevent timing attacks
  5. Allows or denies the request based on the match
Implementation Reference (router/middleware/middleware.go:166-186):

Protected Endpoints

The following endpoints require Bearer token authentication: System Management:
  • POST /api/update - Update Wings configuration
  • GET /api/system - Get system information
  • GET /api/servers - List all servers
  • POST /api/servers - Create new server
  • DELETE /api/transfers/:server - Delete transfer
  • POST /api/deauthorize-user - Deauthorize user tokens
Server Management:
  • All /api/servers/:server/* endpoints except WebSocket

Authentication Errors

error
Missing or malformed Authorization header.
Response Headers:
error
Valid Authorization header format but incorrect token.

JWT Authentication

Overview

JWT (JSON Web Tokens) provide temporary, signed access to specific Wings resources without requiring the static Bearer token. JWTs are used for:
  • WebSocket connections
  • File downloads
  • Backup downloads
  • File uploads
  • Server transfers

JWT Algorithm

Wings uses HMAC-SHA256 (HS256) for JWT signing and verification, with the secret key derived from the Wings authentication token. Implementation Reference (router/tokens/parser.go:20-29):

WebSocket JWT

WebSocket connections use JWTs to authenticate users and define permissions.

Payload Structure

Example WebSocket JWT Payload

Connecting to WebSocket

The WebSocket endpoint is publicly accessible but requires JWT authentication after connection:
Connection Flow:
  1. Client connects to WebSocket endpoint (no Bearer token required)
  2. Wings upgrades the connection
  3. Client sends auth event with JWT
  4. Wings validates JWT and permissions
  5. Connection is authenticated
Example Connection:

Token Denylist

Wings maintains a denylist of revoked JWTs to prevent unauthorized access: Implementation Reference (router/tokens/websocket.go:80-111):

Revoking WebSocket Access

The Panel can revoke WebSocket access using:
Omit the servers array to revoke access across all servers.

File Download JWT

File downloads use signed URLs with embedded JWTs.

Endpoint

Payload Structure

Example File Download JWT

One-Time Use Enforcement

The unique_id field ensures each token can only be used once: Implementation Reference (router/tokens/file.go:23-25):
After a token is used, its unique_id is marked as consumed, preventing replay attacks.

Backup Download JWT

Backup downloads follow the same pattern as file downloads.

Endpoint

Payload Structure

Example Backup JWT

File Upload JWT

File uploads use JWTs in query parameters with multipart form data.

Endpoint

Payload Structure

Upload Request Example

File Validation:
  • Maximum file size enforced (default: 100 MB)
  • Files checked against egg denylist
  • Total upload size validated
  • Permissions set to 0644

Transfer JWT

Server transfers between Wings instances use JWTs for authentication.

Endpoint

Payload Structure

The receiving Wings instance validates the JWT was issued by the Panel before accepting the transfer.

Security Best Practices

Never expose your Wings Bearer token. It grants full administrative access to all servers on the node.

Token Storage

  • Store the Bearer token securely in /etc/pterodactyl/config.yml
  • Restrict file permissions: chmod 600 /etc/pterodactyl/config.yml
  • Never commit tokens to version control
  • Rotate tokens if compromised

JWT Security

  • Set short expiration times (typically 15-60 minutes)
  • Use one-time tokens for sensitive operations (downloads, uploads)
  • Implement proper token revocation via the denylist
  • Validate all JWT claims, especially exp and iat

Network Security

  • Always use HTTPS/TLS in production
  • Configure trusted_proxies correctly if behind a reverse proxy
  • Restrict Wings API access to Panel backend only (firewall rules)
  • Use VPN or private networks when possible

Constant-Time Comparison

Wings uses crypto/subtle.ConstantTimeCompare for token validation to prevent timing attacks:
This ensures token comparison takes the same amount of time regardless of where the mismatch occurs, preventing attackers from deducing token characters through timing analysis.

Example: Complete API Request

System Information Request

Response:
Response Headers:

Server Power Action

Response:
The action is processed asynchronously. Status updates are sent via WebSocket events.