refreshCookie
Proactively refreshes a cookie session using Roblox’s session refresh endpoint. This creates a new session and invalidates the old one, returning the new cookie. Use this to manually trigger cookie rotation before the automatic rotation kicks in, or to refresh cookies on a schedule to ensure they don’t expire. This function uses the library’s internal fetch mechanism, which includes:- Automatic CSRF token handling
- Hardware-backed authentication (HBA) signatures
- Generic challenge handling (if configured)
Parameters
Index in the cookie pool to refresh. Ignored if using a single cookie.
Returns
Result object with success status and new cookie value if successful.
Examples
getCookies
Gets the current cookie values from the pool. Useful for debugging or persisting all current cookie values.Returns
Array of current cookie values, or empty array if none configured.
Examples
updateCookie
Updates a specific cookie in the cookie pool by index. Useful for manually updating cookies when you receive rotation events through other means.Parameters
The index in the cookie pool to update (0 for single cookie).
The new cookie value.
Returns
true if the cookie was updated, false if the index was invalid.Examples
The
updateCookie function updates both the cookie pool and the session cookie cache (for 'none' rotation mode). The internal cookie pool is automatically updated when using refreshCookie or when RoZod detects automatic cookie rotation.