configureServer() to set up authentication once at application startup.
Basic configuration
Configure authentication with a single Roblox account:Getting your cookie
To obtain your.ROBLOSECURITY cookie:
- Log into Roblox in your browser
- Open browser DevTools (F12)
- Go to Application → Cookies → https://www.roblox.com
- Copy the value of the
.ROBLOSECURITYcookie
The cookie value typically starts with
_|WARNING:-DO-NOT-SHARE-THIS.... Include the full value including the warning prefix.User agent configuration
RoZod automatically includes realistic browser user agents in server requests to avoid rate limiting. You can customize this behavior:Default user agents
RoZod includes a pool of common browser user agents that are automatically rotated:Custom user agents
Provide your own user agents:Disable user agents
Set an empty array to disable user agent injection:OpenCloud API keys
For OpenCloud endpoints, configure your API key:The API key is automatically applied only to OpenCloud endpoints (URLs containing
/cloud/). Cookies are used for all other Roblox APIs.Configuration management
View current configuration
Get a read-only copy of the current configuration:Clear configuration
Reset all server configuration:Manual headers (legacy)
You can still pass headers manually per-request if needed:Manual headers take precedence over
configureServer() defaults. This can be useful for per-request customization or testing.Runtime support
RoZod’s server authentication works across all JavaScript runtimes:- Node.js
- Bun
- Deno
Security best practices
Environment variables
Store cookies in environment variables:Secret management
For production applications, use proper secret management:Cookie rotation handling
Roblox may rotate cookies for security. Configure a callback to persist new values:See Cookie rotation for detailed information on handling cookie rotation.
Troubleshooting
Authentication failures
If requests fail with authentication errors:- Verify cookie format: Ensure you copied the complete cookie value
- Check expiration: Roblox cookies can expire - get a fresh one
- Test manually: Use the cookie in a REST client like Postman
- Check account status: Ensure the Roblox account isn’t locked or banned
Rate limiting
If you’re hitting rate limits:- Use cookie pools: Distribute load across multiple accounts
- Add delays: Implement backoff between requests
- Use user agents: Ensure realistic user agents are configured
Next steps
Cookie pools
Use multiple accounts for load distribution
Cookie rotation
Handle automatic cookie rotation
OpenCloud keys
Configure OpenCloud API authentication
Security features
Understand automatic security mechanisms