Appearance
State & Security
The Platform SDK is built with casino-grade security protocols in mind.
API Key & Domain Whitelisting
Every request made by the SDK automatically includes an x-platform-key header containing your API Key.
Domain Whitelisting: Because frontend applications are inherently public, your backend must verify the Origin header of incoming requests. If someone steals your API Key and tries to use it from evil.com, your backend will reject the request via CORS policies.
Token Management Strategy
The SDK uses a dual-token system to secure user sessions:
- Access Token: Short-lived (e.g., 15 minutes). Stored in SDK memory. Used to authorize all
/v1/API requests. - Refresh Token: Long-lived (e.g., 7 days). Stored in
localStorage. Used exclusively to fetch new Access Tokens.
This mitigates XSS (Cross-Site Scripting) attacks. If an attacker steals the access token from memory, it expires in 15 minutes. They cannot steal the refresh token from memory.
401 Auto-Retry Interceptor
If a user leaves their tab open for 20 minutes, the Access Token will expire.
When they return and click a button, the SDK will:
- Attempt the API request.
- Receive a
401 Unauthorizedresponse. - Silently pause the request, call
/v1/auth/refreshusing the Refresh Token. - Save the new Access Token.
- Retry the original API request.
This entire process happens in the background. The frontend user experiences zero interruptions.