Skip to content

Authentication Best Practices in Games (in development)

Authentication is a crucial component in modern games, enabling cloud save functionality, seamless cross-device access, and social integration. Balancy provides flexible authentication options to suit different game requirements. Below are best practices for handling authentication in games.


Authentication Scenarios

1. No Custom Authentication (Default Balancy Authentication)

By default, Balancy authenticates players using deviceId, allowing them to:

  • Store their progress in the cloud.
  • Restore their progress later on the same device, if deviceId doesn't change.

This authentication method is invisible to the player, requiring no developer intervention. Everything is handled by Balancy automatically and under the hood.

Pros:

✔ No additional implementation required.
✔ Seamless experience with automatic cloud saving and restoring.
✔ Ideal for casual games with no account linking requirements.

Cons:

✖ Players may lose progress if they change devices or deviceId changes after the app is reinstalled. ✖ No cross-platform or multi-device support unless manually linked to another authentication method.


2. Forced Authentication at Game Start

Some games require players to authenticate before loading their profile using a method like:

  • Email & Password
  • Apple ID
  • Google
  • Facebook
  • Other third-party authentication providers

In this case:

  • The game displays a login screen at the start.
  • The user must authenticate before Balancy loads their profile.
  • The authentication token is cached for future sessions, allowing automatic login.
  • Until authentication is complete, only game content is loaded, but the user profile is not.

Pros:

✔ Ensures player progress is always recoverable.
✔ Allows seamless cross-platform progression.
✔ Prevents issues with lost deviceId.

Cons:

✖ Requires players to create or log in to an account before playing.
✖ Potential friction for new players who just want to try the game.


Managing Authentication in Settings

Regardless of the authentication scenario, players may need to manage their accounts from the Settings menu.

1. Linking Additional Authentication Methods

Players should be given an option to link additional authentication methods (e.g., Facebook, Google, Apple ID).

UI Implementation:

  • Show a list of available authentication methods.
  • If a method is already linked, show a Unlink button.
  • If a method is not linked, show a Link button.
  • (Optional) Provide rewards for linking new authentication methods.

Handling Conflicts:

If the player tries to link a new authentication method that is already linked to another account, a conflict arises.

Conflict Resolution Popup:

  1. Unlink & Link to Current Account

    • The authentication method is unlinked from the previous account.
    • It is now linked to the player’s current session.
    • The player continues playing without interruption.
  2. Load the Other Account

    • The account associated with the authentication method is loaded.
    • The player's local progress may be lost unless linked to another method.

Best Practice:
Before allowing a switch, warn the player about potential progress loss.


2. Changing Accounts

Case 1: Automatic Authentication (Device ID)

For games using Balancy's automatic authentication, include a "Change Account" or "Load Account" button.

Flow:

  1. The player clicks "Change Account".
  2. A popup appears showing available authentication methods (Facebook, Google, etc.).
  3. The player selects a method and logs in.
  4. If an account is found:

    • The game loads the new account.
    • The local progress is lost.
  5. If no account is found:

    • The player is asked: "No account found. Do you want to create a new account?"
    • The developer can provide an option to create a new account.

Warning Players About Progress Loss:
If the local account has no linked authentication methods, show a warning before switching accounts.


Case 2: Forced Authentication (Login Required at Start)

For games that require login at startup, instead of a "Change Account" button, provide a "Log Out" button.

Flow:

  1. The player clicks "Log Out".
  2. The game returns to the login screen.
  3. The player must re-authenticate before continuing.
  4. No gameplay is allowed until authentication is complete.

This method ensures strict account control, preventing unauthorized or accidental progress overwrites.


Summary of Best Practices

Scenario Best Practice
No Custom Authentication (Device ID) No action required; progress is stored automatically.
Forced Authentication (Login required) Authenticate before loading the profile; cache token for future sessions.
Linking Authentication Methods Allow linking/unlinking; resolve conflicts with "Unlink & Link" or "Load Another Account".
Changing Accounts (Auto Auth) Provide a "Change Account" button with authentication options and a progress loss warning.
Changing Accounts (Forced Auth) Use a "Log Out" button that forces the player to log in again.

Following these best practices ensures seamless authentication, data security, and a better player experience across all platforms.