Quickstart
Add one button to your game. Players sign in with their Gamavas account in a small popup, and your game gets their profile.
1. Connect your game
Sign in here, choose Connect a game, pick your listing and add the page your game runs on. You get a client ID. It's public: there's no secret to keep.
2. Add the button
Load the script on the page your game runs on, before anything heavy, so the popup can close quickly.
<script src="https://staging.gamavas.fun/sdk/pass.js"></script> <gamavas-signin client-id="YOUR_CLIENT_ID" theme="brand"></gamavas-signin>
When a player signs in, the element fires an event with their profile:
document.addEventListener("gamavas-signin", (event) => {
const { player, pass } = event.detail;
startGame(player.handle);
});
document.addEventListener("gamavas-error", (event) => {
// event.detail.error.code: "popup_closed", "access_denied", …
});Button options
The Gamavas mark always shows, so players recognise the button.
| Attribute | Values |
|---|---|
| theme | dark (default), light, brand, outline |
| size | small, medium (default), large |
| shape | pill (default), rounded, square |
| text | signin (default), continue, signup, play |
| width | full, or a width in pixels |
| color | your own hex colour, like #5724ff; the text stays readable |
| also ask for the player's email (they can decline) |
Using JavaScript
For your own button or more control:
const pass = GamavasPass.create({ clientId: "YOUR_CLIENT_ID" });
await pass.ready; // finishes a sign-in that came back to this page
pass.user; // the signed-in player, remembered between visits, or null
const player = await pass.signIn(); // call from a click: opens the popup
const withEmail = await pass.signIn({ email: true });
const token = await pass.getAccessToken(); // for calling Gamavas from your server
pass.onChange((player) => { /* signed in or out */ });
await pass.signOut(); // signs out of your game, not of Gamavas
// Or render the button yourself:
GamavasPass.renderButton(pass, document.querySelector("#signin"), {
theme: "light", size: "large",
onSignIn: (player) => startGame(player),
onError: (error) => console.log(error.code),
});What your game gets
| Field | What it is |
|---|---|
| id | Their Gamavas ID: the same in every game |
| handle | Their Gamavas handle |
| displayName | The name they chose on Gamavas |
| avatarUrl | Their avatar |
| Only if you asked and they agreed; otherwise null |
Players can disconnect your game at any time in their Gamavas settings. After that, getAccessToken() returns null and onChange reports them signed out.
How it works
- The popup returns to the page you registered, which must load the script. The script passes the result back to your game's window and closes the popup.
- If a browser blocks the popup, the whole page goes to Gamavas and comes back signed in.
- Sign-in uses OAuth 2.1 with PKCE, so nothing secret lives in your game's code. OpenID Connect discovery is at
https://staging.gamavas.fun/api/auth/.well-known/openid-configuration. - Until your listing is live, only you can sign in to your game, so you can test it while it's in review.