Skip to content

CrazyGames sign-in for HTML5 games

A game published on CrazyGames, and its game id from the developer portal. The account of a player exists only inside crazygames.com: a game embedded anywhere else gets no token, and window.CrazyGames.SDK.user.isUserAccountAvailable says so before the sign-in is tried.

Choose an environment in the header, open Project settings → Authentication and add a CrazyGames connection.

FieldMeaning
Game idThe id of your game on CrazyGames. A token of another game is refused.

Inside the CrazyGames page the game asks their SDK for the user token and sends it.

import { Session } from '@rudder/sdk';
const token = await window.CrazyGames.SDK.user.getUserToken({ signingKeyType: 'IN_GAME_AUTH' });
const session = await Session.signIn(key, {
provider: 'crazygames',
payload: { idToken: token },
});

A WebGL build reaches the SDK of CrazyGames through a JavaScript bridge, and the same token goes into the same payload:

using RudderSdk;
var session = await Session.SignInAsync(key, new ProviderSignIn
{
Provider = "crazygames",
Payload = new Dictionary<string, object?> { ["idToken"] = tokenFromTheBridge },
});

A native build has no bridge to that SDK and no page of crazygames.com around it, so it cannot sign in this way.

The signature against the published keys of CrazyGames, the expiry, and that the token names your game id. The player is the userId of the token; its username and profilePictureUrl fill a nickname and an avatar the player does not have yet.

  • A token of another game, or one that is expired or foreign, answers 401 unauthorized.
  • CrazyGames not answering its keys answers 503 try_again.

The rest are in Errors.