Authentication
The SensorUp GraphQL API supports multiple authentication methods depending on your use case and environment.Authentication Methods
All authentication methods use the same session ID mechanism - either via the
sensorup_sessionid cookie (browser) or x-sensorup-sessionid header (API clients).
Session-Based Authentication
Session-based authentication is the primary method for interactive applications where users log in with username and password.Sign In
Session Response
Checking Current Session
Sign Out
Using Your Session
After successful sign-in, your session ID is used to authenticate subsequent API requests. There are two methods:1. Cookie Authentication (Browser/Web)
When you sign in through a web browser, thesensorup_sessionid cookie is automatically set and sent with each request:
2. Header Authentication (Machine-to-Machine)
For API clients, mobile apps, and integrations, pass the session ID in thex-sensorup-sessionid header:
Multi-Factor Authentication (MFA)
When MFA is required, the sign-in mutation returns achallengeName:
MFA Challenge Response
Challenge Types
Completing MFA Challenge
API Key Authentication
API keys are designed for machine-to-machine communication and integration scenarios. API keys generate sessions just like user logins, but with longer lifetimes.Creating an API Key
apiKeySessionId which is the session ID you’ll use for authentication.
API keys provide full access to the API with the same permissions as the user who created them. Store them securely and rotate them regularly.
Using API Keys
Use the API key session ID in thex-sensorup-sessionid header (same as regular sessions):
AWS Credentials
For accessing AWS services (S3, etc.), you can obtain temporary AWS credentials:Getting AWS Credentials
Using AWS Credentials
Federated Sign-In (SSO)
For organizations using SSO, you can authenticate with Cognito tokens:SSO configuration is tenant-specific. Contact your SensorUp account team for SSO setup and configuration.
Session Management
Session Expiration
Sessions have two expiration times:- Soft Expiry (Idle Timeout): Session extends with activity up to this limit
- Hard Expiry (Maximum Lifetime): Absolute maximum session duration - requires re-authentication after this time
How it works:
- If you’re actively using the API, your session stays valid until the hard expiry time
- If you’re inactive for longer than the soft expiry (idle timeout), the session expires
- After hard expiry, you must sign in again regardless of activity
- The
expiresAtfield in the session response reflects the current soft expiry time - The
expiresAtHardfield shows the absolute maximum session lifetime
Switching User Groups
If your user has access to multiple tenant groups:Re-authentication
For sensitive operations, you may need to re-authenticate:Device Management
Track and manage authenticated devices:Listing Devices
Forgetting Devices
Password Management
Forgot Password
Reset Password
Authentication Configuration
Query authentication configuration for your environment:Best Practices
- Use sessions for interactive applications: Session-based auth with MFA provides the best security for user-facing applications
- Use API keys for integrations: Machine-to-machine communication should use API keys with appropriate scoping
- Rotate credentials regularly: Implement key rotation policies for long-lived API keys
-
Handle session expiration gracefully: Check
expiresAtand refresh or re-authenticate before expiration - Store credentials securely: Never commit credentials to version control; use environment variables or secret management systems
- Monitor authentication events: Track authentication failures and unusual patterns
Next Steps
- Quickstart Guide - Make your first authenticated query
- Common Patterns - Learn about pagination and filtering
- Domain Guides - Explore specific API capabilities