JWT Tokens
Session-based authentication for dashboard and developer portal access
API Keys
Long-lived credentials for server-to-server API integration
Authentication Methods
JWT Tokens (Developer Portal)
JSON Web Tokens are used for authenticating developers accessing the dashboard and developer portal. JWTs are short-lived (configurable expiration) and include refresh token support. Use JWT tokens when:- Building web applications with user sessions
- Accessing developer account management endpoints
- Managing API keys through the dashboard
- Short-lived access with automatic refresh is preferred
API Keys (Server Integration)
API keys are long-lived credentials designed for server-to-server communication. They provide programmatic access to the API without requiring user sessions. Use API keys when:- Integrating Open Wearables into your backend services
- Building automated scripts or data pipelines
- Accessing wearable data on behalf of your users
- Long-lived credentials are acceptable
Authentication Flow Comparison
- JWT Tokens
- API Keys
Quick Start Examples
Security Best Practices
Store credentials securely
Store credentials securely
- Never commit API keys or tokens to version control
- Use environment variables or secret management systems
- Rotate API keys periodically
- Delete unused API keys immediately
Use HTTPS only
Use HTTPS only
- All API requests must use HTTPS
- Never send authentication credentials over HTTP
- Validate SSL certificates in production
Implement token refresh
Implement token refresh
- Store refresh tokens securely (httpOnly cookies recommended)
- Implement automatic token refresh before expiration
- Handle 401 errors gracefully by refreshing tokens
- Log out users when refresh tokens expire
Monitor API key usage
Monitor API key usage
- Track which services use which API keys
- Set up alerts for unusual activity
- Use different API keys for different environments
- Rotate keys immediately if compromised
Error Handling
Both authentication methods return standard HTTP status codes:| Status Code | Description | Action |
|---|---|---|
200 | Success | Continue with response data |
401 | Unauthorized | Invalid credentials or expired token - re-authenticate |
403 | Forbidden | Valid auth but insufficient permissions |
422 | Validation Error | Check request body format |
429 | Rate Limited | Reduce request frequency |
500 | Server Error | Retry with exponential backoff |
Next Steps
JWT Token Authentication
Learn about login, token refresh, and session management
API Key Management
Create, rotate, and manage API keys for your integrations
