Authentication

Authentication

Authentication is an essential step when initializing ChafKit in your game. It involves accessing the CHAFKIT_TOKEN, which is set when the game is launched using the Chaf Games Desktop Application. During development, you can manually set the development token to test authentication.

Authentication is required for various reasons, including verifying the user's identity and ensuring proper access privileges. It helps prevent unauthorized usage of game features and ensures a secure and personalized experience for players.

Authentication can fail under the following circumstances:

  • The authentication token is not provided or is invalid.
  • The user does not have the necessary permissions to access the game, either by not subscribing to the required membership or by not purchasing the game.
  • The network connection is offline or unreliable.

When authentication succeeds, you gain access to valuable user information, including the unique user ID (string type), unique username, profile image, and display name. It's important to note that the display name may not be unique across all users.

In addition to standard authentication, ChafKit also provides secure authentication. This feature is particularly useful when you have your own game server and need to authorize users. ChafKit offers an external token that ensures the integrity of the data, providing a layer of protection against tampering or unauthorized modifications.

In the upcoming sections, we will explore how to retrieve profile data and how to implement secure authentication when using your own game server.