Skip to content

Account integration requirements

The CrazyGames account system

The CrazyGames account system is a powerful tool that allows our users to save progress, play on multiple devices, customize their username and avatar and play with their friends. The most succesful games on our site integrate seamlessly with our account system.

CrazyGames has over 15M registered users, many of them playing actively every week.

We want to ensure this experience for our users:

  • No standalone in-game username are needed
  • No additional login flows in-game are needed
  • Guests can also play the games

Integration scenarios

We understand these requirements can have a substantial impact on your game. However it's not necessary to do customization before releasing your initial game version which we describe below. We distinguish these account integration scenarios:

Full Implementation

This scenario is meant for games that have in-game accounts with a custom back-end. We want to ensure a smooth login experience for CrazyGames users, meaning:

  • New logged in CrazyGames users are automatically registered & logged in within your game.
  • Returning logged in CrazyGames users are automatically logged in within your game.
  • CrazyGames guests can play your game as guests
  • Logging out in the game and allowing login with external login options (e.g. Facebook, Google, email) is not allowed.
    • If you want to offer importing existing accounts or exporting CrazyGames account, you are responsible for transferring progress correctly. Refer to Account linking in the appropriate SDK docs for functionality we provide.

Preparation

Your CrazyGames game version will need to allow using CrazyGames userId as identifiers within the game. This is a unique string tied to the CrazyGames account that can be accessed through the User module in our SDK.

At game launch

Start by retrieving the current user by calling getUserToken() to get a JWT Token and verifying the token on your server. This will get you the player's userId.

Warning

  • The game should request the current user account every time the game starts, making sure to cover cases where different users share the same device.
  • For the case where a Guest logs in while playing, check the paragraph below.
  • Avoid using local data to identify Guests across sessions as multiple users might share the same device.
User is not logged in (userNotAuthenticated error)

You should always allow the user to start playing as Guest, as main action.

It's allowed to show a Login with CrazyGames button, but not as main CTA.

  • For example in the top right corner
  • If you do this, the button should trigger the Auth prompt method in our SDK

Please note:

  • Don't allow Guests to use different login methods than 'Login with CrazyGames'
  • Don't trigger the Auth prompt automatically as this might confuse the user
User is logged in on CrazyGames (userId is returned)

Check if the CrazyGames userId account already exists in your back-end.

  • Case: CrazyGames account (userId) is already known in your back-end:
    • Users can update their CrazyGames username & avatar, so if you store this info on your back-end make sure to update it by calling an endpoint on your server with the actual username and profile picture.
    • Fetch the data for this user from your back-end, and start playing!
  • Case: The CrazyGames account (userId) is not yet known to your game:
    • Automatically create a game account using the player's CrazyGames account. Make sure to make the link based on the userId unique field, as other fields like username might change.
    • (optional) If feasible and desired, you can save any local progress the user made as guest to the new account. Alternatively this user will have fresh data in your back-end.

Game login button

  • You can show a Login button in your menu for Guests, which triggers the same flow as described above in "At game launch".
  • You should not display a login page (for example containing external accounts like Google or Facebook).
  • The game should also not allow the user to logout.

Players changing CrazyGames accounts while playing

Mandatory for games using In-Game Purchases, optional for other games

  • Users logging into their CrazyGames account while playing can be detected using an Auth Listener, in this case we will expect you to follow the "User is logged in on CrazyGames" flow above and if necessary refresh the game. This only applies to users playing as guest in the game and is optional.
  • When a user logs out during gameplay, the entire web page is refreshed, so there is nothing else to do in this case. The game flow will start from the beginning.

Basic Implementation

If your game doesn’t have the notion of users, you are not expected to integrate with our user module.

You can however use the Data module in our SDK to save user progress, or alternatively rely on our APS system.

Full Implementation

Improve the gamer's experience by showing their username and profile picture in your game.

  • You can retrieve the user object from the user module to obtain user profile info
  • In case the result is null the user is not logged in on CrazyGames and you should continue as guest.
  • You can use the Data module in our SDK to save user progress, or alternatively rely on our APS system.

Progress save

Full Implementation

Players care A LOT about their progress in games, and expect their progress to synchronize across their devices. CrazyGames offers a number of methods to save progress in the cloud. Unless progress is not applicable for your game, you need to implement one of these methods.

  1. Using the Data module which saves the user's progress on their CrazyGames account
  2. If your game has their own back-end, use the User module to link progress in your back-end to the user's CrazyGames account
  3. Alternatively you can use our Automatic Progress Save system. This is not allowed for games with in-game purchases as it relies on local data.