Overview
SuperBox uses Firebase Authentication with JWT (JSON Web Tokens) for secure API access. All authenticated endpoints require a valid Bearer token in the Authorization header.Authentication Method
Firebase JWT Bearer Token Authentication
Getting Your API Token
1
Create an Account
Sign up at SuperBox using one of our supported providers:Google
Email
Sign in with Google
GitHub
Sign in with GitHub
Email/Password
2
Navigate to Settings
Go to your Profile Settings page.
3
Generate API Token
Click “Generate API Token” to create a new authentication token.
4
Copy and Store
Copy your token and store it in a secure location like:
- Environment variables
- Secure password manager
- Encrypted configuration file
Never commit tokens to version control or share them publicly.
Using Your Token
Environment Variable (Recommended)
Store your token in an environment variable:Direct Usage
For testing or development, you can use the token directly:Authentication Flow
Token Validation
When you make an authenticated request, the API validates your token:1
Extract Token
API extracts the Bearer token from the Authorization header
2
Verify Signature
Token signature is verified using Firebase public keys
3
Check Expiration
Token expiration time is checked
4
Extract Claims
User ID and other claims are extracted from the token
5
Authorize Request
User permissions are checked for the requested resource
Token Structure
Firebase JWT tokens contain three parts separated by dots:Token Payload Example
Unique user identifier
User’s email address
Token expiration timestamp (Unix time)
Token issued at timestamp (Unix time)
Token Expiration
Token Lifetime
Firebase tokens expire after 1 hour (3600 seconds)
401 Unauthorized response:
Automatic Token Refresh
The SuperBox frontend automatically refreshes tokens before they expire. For API clients, implement token refresh logic:Public vs Authenticated Endpoints
- Public Endpoints
- Authenticated Endpoints
Permission Levels
SuperBox implements resource-level permissions:Read Permission
Read Permission
All authenticated users can read any server’s information
Write Permission
Write Permission
Only the server owner can update their server’s metadata
Delete Permission
Delete Permission
Only the server owner can delete their server
Admin Permission
Admin Permission
SuperBox admins can modify or delete any server
Error Responses
Missing Token
Invalid Token
Expired Token
Insufficient Permissions
Best Practices
Store Tokens Securely
Store Tokens Securely
- Use environment variables - Never hardcode tokens in source code - Don’t commit tokens to version control - Use secret management services (AWS Secrets Manager, HashiCorp Vault)
Implement Token Refresh
Implement Token Refresh
- Check token expiry before requests - Refresh tokens proactively (5 min before expiry) - Handle 401 responses gracefully - Retry failed requests after refresh
Use HTTPS Only
Use HTTPS Only
- Always use HTTPS for API requests - Never send tokens over unencrypted connections - Validate SSL certificates
Rotate Tokens Regularly
Rotate Tokens Regularly
- Generate new tokens periodically - Revoke old tokens after rotation - Monitor token usage for anomalies
Monitor for Breaches
Monitor for Breaches
- Set up alerts for unusual activity - Review access logs regularly - Revoke compromised tokens immediately
SDK Authentication
Using our official SDKs simplifies authentication:Testing Authentication
Test your authentication setup:You’re all set! You now know how to authenticate with the SuperBox API.