Automatic cookie handling
When users are logged into Roblox in their browser, RoZod automatically includes their authentication cookies with every request:RoZod uses
credentials: 'include' by default to ensure cookies are sent with cross-origin requests to Roblox domains.How it works
RoZod automatically detects when running in a browser environment and:- Includes credentials: All requests use
credentials: 'include'to send cookies - Handles XCSRF tokens: Automatically retrieves and includes CSRF tokens for write operations
- Manages HBA signatures: Generates hardware-backed authentication signatures when needed
- Handles challenges: Processes captcha and 2FA challenges if configured
Browser detection
RoZod detects browser environments by checking if the current page is on a.roblox.com domain:
- Skips server-specific configuration (cookies, user agents)
- Uses the browser’s native cookie handling
- Automatically enables HBA authentication
Use cases
Browser extensions
RoZod is production-tested in RoGold, a browser extension with 800,000+ active users:Web applications
For web apps that need to make requests to Roblox APIs:Manual headers (advanced)
In rare cases where you need to override default behavior, you can pass custom headers:Manual headers should rarely be needed. The automatic behavior works for the vast majority of use cases.
Security considerations
Cookie security
RoZod leverages the browser’s built-in cookie security:- Cookies are
HttpOnlyandSecureby default (managed by Roblox) - Same-site protections prevent CSRF attacks
- Cookies are scoped to
.roblox.comdomains
Challenge handling
If Roblox presents authentication challenges (captcha, 2FA), you can configure a handler:See Challenge handling for more details on implementing challenge handlers.
Debugging
To verify that authentication is working in the browser:- Check browser DevTools: Open Network tab and verify
.ROBLOSECURITYcookie is sent - Check response headers: Look for
x-csrf-tokenheaders in responses - Test with error handling: Use
isAnyErrorResponse()to catch auth errors
Next steps
Server authentication
Learn about server-side authentication configuration
Security features
Understand automatic security mechanisms
Challenge handling
Implement captcha and 2FA handlers
Error handling
Handle authentication errors gracefully