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.

AttributeValues
themedark (default), light, brand, outline
sizesmall, medium (default), large
shapepill (default), rounded, square
textsignin (default), continue, signup, play
widthfull, or a width in pixels
coloryour own hex colour, like #5724ff; the text stays readable
emailalso 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

FieldWhat it is
idTheir Gamavas ID: the same in every game
handleTheir Gamavas handle
displayNameThe name they chose on Gamavas
avatarUrlTheir avatar
emailOnly 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