Initialization Options
Options Reference
apiKey (Required)
Your Gately API key. Use public keys (gately_pk_) for browser apps and secret keys (gately_sk_) for server-side only.
apiUrl
The base URL for API requests. Only change this for self-hosted deployments.autoRefresh
Automatically refresh the session before it expires.
When enabled, the SDK will:
- Monitor session expiry time
- Refresh the token 5 minutes before expiry
- Update stored session automatically
suppressConsoleErrors
Suppress error messages in the browser console.React Provider Configuration
CDN Configuration
Configure via data attributes:Environment-Based Configuration
Server-Side Configuration (Node.js)
For server-side applications, use your secret API key:Session Storage
By default, sessions are stored inlocalStorage. The SDK also sets cookies for cross-origin compatibility:
Debugging
Enable verbose logging for debugging:- API requests and responses
- Session management events
- Page protection checks
- OAuth flow details