get_sdk_snippet
Returns a ready-to-paste code snippet for submitting scores or initializing the SDK, tailored to your game’s auth and hosting setup. Supports anti-cheat, OAuth, and server-side languages.
Instructions
Call this whenever the developer asks how to submit a score, initialize the SDK, or integrate a leaderboard into their code — INCLUDING when they want a setup other than the default: anti-cheat (server-validated scores), OAuth player identity, or a non-TypeScript server. Returns a ready-to-paste integration snippet (the snippet field) tailored to the axis arguments. Omit the axis args for the simplest anonymous + client-only TypeScript setup; set hostingPattern='client_with_server' (+ a serverLanguage and/or auth provider) for the secure anti-cheat path. Use it right after bootstrap_leaderboard, or any time the developer needs the integration code again or wants to switch approach. (For the drop-in widget HTML embed, bootstrap_leaderboard returns it as snippets.widget.)
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| gameId | Yes | UUID of the game | |
| boardId | Yes | UUID of the board to target in the snippet | |
| playerIdentityStrategy | No | How players are attributed. 'anonymous' (default) mints a local UUID, no PII; 'prompted_local' asks once and saves to localStorage; 'auth_provider' uses OAuth (also set authProvider); 'server_authoritative' has the game server attach the playerId (needs hostingPattern client_with_server or server_only); 'custom_callback' for a dev-supplied function. | |
| authProvider | No | Required when playerIdentityStrategy is 'auth_provider'. supabase/clerk/auth0/firebase get a server-side JWT-verifying secure-submit endpoint (real anti-cheat); google ships a browser helper; github/apple/discord are planned; custom is the escape hatch. | |
| hostingPattern | No | Integrity model. 'client_only' (default): the browser holds the public key — simplest, but NO anti-cheat. 'client_with_server': your server validates + signs scores — use this for competitive boards where cheating matters. 'server_only': server reads/writes and renders SSR HTML (max integrity, SEO-friendly, no widget). | |
| serverLanguage | No | Language for the server-side snippet. Required for hostingPattern 'server_only'; optional for 'client_with_server' (defaults to typescript, which gets the turnkey createScoreSubmitHandler endpoint). python/go/csharp return a best-effort snippet. |