iOS Mobile Companion
Native iOS app for ServerBee with QR pairing, push notifications, and real-time monitoring.
ServerBee provides a native iOS companion app that brings server monitoring to your mobile device. Get real-time metrics, receive push notifications for alerts, and manage your servers on the go.
Features
- QR Code Pairing -- Scan a QR code from the web app to authenticate instantly, no manual token entry required
- Push Notifications -- Receive APNs (Apple Push Notification service) alerts directly on your iPhone when servers go offline or thresholds are breached
- Real-time Metrics -- Live server status, CPU, memory, disk, and network metrics streamed via WebSocket
- Alert History -- View recent alerts and their status (triggered/resolved) with detailed information
- Secure Authentication -- Bearer token-based auth with automatic refresh (15-min access token, 30-day refresh token)
Requirements
- iOS 16.0 or later
- A ServerBee server instance (v0.8.0+) with mobile auth enabled
- For push notifications: APNs authentication key configured on the server
Pairing Your Device
1. Enable Mobile Auth (Server-side)
Mobile authentication is enabled by default in v0.8.0+. No additional server configuration is required unless you want to adjust token TTLs.
Optional configuration in server.toml:
[mobile]
access_ttl = 900 # Access token lifetime in seconds (default: 15 minutes)
refresh_ttl = 2592000 # Refresh token lifetime in seconds (default: 30 days)2. Start Pairing from Web App
- Log in to your ServerBee web app
- Go to Settings → Mobile Devices
- Click Pair New Device
- A QR code will be displayed with a 5-minute expiry timer
3. Scan with iOS App
- Open the ServerBee iOS app
- Tap Scan QR Code on the welcome screen
- Point your camera at the QR code displayed in the web app
- The app will automatically authenticate and show your server list
Managing Paired Devices
View Connected Devices
In the web app, go to Settings → Mobile Devices to see all paired iOS devices:
- Device name (e.g., "iPhone 15 Pro")
- Paired date and time
- Last active timestamp
- Current online/offline status
Revoke Access
To remove a device's access:
- In the Mobile Devices list, find the device you want to remove
- Click the Revoke button
- Confirm the action
The device will be immediately logged out and all its tokens invalidated.
Push Notifications (APNs)
Server Configuration
To enable push notifications, configure APNs credentials in the web app:
- Go to Settings → Notifications
- Add a new notification channel with type APNs
- Upload your APNs authentication key (.p8 file from Apple Developer Portal)
- Enter your Team ID, Key ID, and Bundle ID
- Test the configuration with the Test button
Required APNs Fields
| Field | Description |
|---|---|
| Team ID | Your Apple Developer Team Identifier (10 characters) |
| Key ID | The Key ID from your APNs auth key in Apple Developer Portal |
| Bundle ID | Your iOS app bundle identifier (e.g., com.example.serverbee) |
| Private Key | The .p8 file content from Apple Developer Portal |
Creating an APNs Key
- Go to Apple Developer Portal
- Navigate to Certificates, Identifiers & Profiles → Keys
- Create a new key with Apple Push Notifications service (APNs) enabled
- Download the .p8 file (can only be downloaded once)
- Note the Key ID displayed on the portal
Security Considerations
- Token Rotation: Refresh tokens are rotated on every use (single-use). Old refresh tokens cannot be reused.
- Fixed Expiry: Access tokens have fixed 15-minute expiry (no sliding renewal) to limit exposure if stolen
- Secure Storage: Tokens are stored in iOS Keychain with appropriate accessibility levels
- Automatic Cleanup: Expired sessions are cleaned up by the server's background task (12-hour interval)
Troubleshooting
QR Code Won't Scan
- Ensure the QR code is displayed clearly on your screen
- Check that the QR code hasn't expired (5-minute timeout)
- Try generating a new QR code from the web app
Push Notifications Not Received
- Verify APNs credentials are correct in the notification channel
- Ensure the iOS app has granted notification permissions
- Check that the device shows as "Online" in Mobile Devices list
- Review server logs for APNs delivery errors
Authentication Failures
- If the app shows "Session Expired", it will automatically refresh the token
- If refresh fails, you'll need to re-pair using a new QR code
- Check that your server time is correctly synced (NTP)
Technical Details
Authentication Flow
- Login/QR Pair: POST
/api/mobile/auth/loginor QR pair endpoint → returns access_token + refresh_token - API Requests: Include
Authorization: Bearer {access_token}header - Token Refresh: On 401, POST
/api/mobile/auth/refreshwith refresh_token → new token pair - Logout: POST
/api/mobile/auth/logoutrevokes all tokens for the device
WebSocket Connection
The iOS app maintains a WebSocket connection for real-time updates:
- Connection URL:
wss://your-server/api/ws/servers - Authentication via
Authorization: Bearerheader during handshake - Automatic reconnection with exponential backoff
- Connection auto-closes when access token expires (reconnect triggers refresh)