Overview
Scira uses session-based authentication powered by better-auth, a flexible authentication library for Next.js applications. Authentication is required for most API operations and determines your rate limits and feature access.Authentication Methods
Session Authentication
Scira primarily uses cookie-based session authentication. When you sign in through the web interface, a secure session cookie is created that authenticates subsequent API requests.Supported OAuth Providers
Scira supports authentication through multiple OAuth providers:- GitHub - Sign in with your GitHub account
- Google - Sign in with your Google account
- Twitter - Sign in with your Twitter/X account
- Microsoft - Sign in with your Microsoft account
Session Configuration
The authentication system is configured with:Making Authenticated Requests
Using Session Cookies
When making requests from a browser or client that supports cookies:cURL Example
For cURL requests, you need to first obtain and save the session cookie:Authentication Levels
Different features require different authentication levels:Unauthenticated Access
Limits:- 3 searches per 7 days
- Basic models only
- No access to Extreme Search mode
- No access to Lookout (scheduled searches)
Authenticated (Free)
Limits:- 100 searches per day
- Access to most models
- Limited Extreme Search usage
- Basic features
- Valid session cookie
- Verified email address
Pro Subscription
Features:- Unlimited searches
- All premium models
- Unlimited Extreme Search
- Lookout (scheduled research agents)
- Priority processing
- No rate limits
- Active subscription through Polar or Dodo Payments
- Valid session cookie
Authentication Headers
Required Headers
All API requests should include:Optional Headers
Session Management
Getting Session Information
To check your current session:Session Validation
Scira validates sessions on every request:- Extracts session cookie from request
- Verifies session token with database
- Checks subscription status (for Pro features)
- Validates chat ownership (for chat-specific operations)
Subscription Status
Pro features require an active subscription. The system checks both Polar and Dodo Payments subscriptions:Error Responses
Authentication Errors
401 Unauthorized - Authentication RequiredBest Practices
Always use HTTPS in production
Always use HTTPS in production
Session cookies contain sensitive authentication tokens. Always use HTTPS to prevent token interception.
Handle session expiration gracefully
Handle session expiration gracefully
Sessions can expire. Implement proper error handling to redirect users to re-authenticate when receiving 401 errors.
Store cookies securely
Store cookies securely
Validate subscription status before Pro features
Validate subscription status before Pro features
Check subscription status before attempting to use Pro-only features to provide better UX.
Next Steps
Search API
Start making search requests
Rate Limits
Understand your usage limits
