Overview
TruSec provides multiple authentication methods to secure your applications. Choose the method that best fits your use case.Authentication Methods
API Keys
Simple key-based authentication for server-to-server communication
OAuth 2.0
Industry-standard OAuth 2.0 flows for user authentication
JWT Tokens
Stateless JSON Web Tokens for scalable authentication
SSO / SAML
Enterprise single sign-on integration
API Key Authentication
Use API keys for server-side authentication. Include your secret key in theAuthorization header:
Key Types
| Type | Prefix | Use Case |
|---|---|---|
| Secret Key | trusec_sk_ | Server-side API calls |
| Public Key | trusec_pk_ | Client-side SDK initialization |
| Test Key | trusec_test_ | Development and testing |
OAuth 2.0
TruSec supports standard OAuth 2.0 flows:Authorization Code Flow
PKCE Flow
For mobile and single-page applications, use PKCE for enhanced security:Session Management
Create a Session
Verify a Session
Revoke a Session
Best Practices
Rotate API keys regularly
Rotate API keys regularly
Set up automatic key rotation every 90 days to minimize the impact of potential key exposure.
Use environment variables
Use environment variables
Never hardcode API keys. Use environment variables or a secrets manager.
Implement rate limiting
Implement rate limiting
Protect your endpoints with rate limiting to prevent brute-force attacks.
Enable audit logging
Enable audit logging
Track all authentication events for security monitoring and compliance.