Authentication and Kreds Integration

This document is meant to give a brief overview of how to integrate the Kongregate Authentication and or Kreds/Microtransaction APIs with your game. The Authentication API will allow your game server to verify the identity of a Kongregate player, while the Microtransaction API lets you manage and sell virtual items. It is important to note that this documentation is geared toward developers who are looking to integrate a secure server-to-server authentication and microtransaction solution.

Before digging into this process, it is highly advisable that you read the following documentation:

Overview

Typically, the first thing a game will do is authenticate a player to log them into the game. When your game is hosted on Kongregate, it can use the Client API to pass the user's unique user_id along with an authentication token to your game server. The game server can then use the Authentication API to verify the player's identity with the Kongregate back-end.

If you plan on implementing virtual items, it is good practice to check player's inventory for any consumable items right after authentication. This will ensure that no items get "lost" due to an untimely disconnect or other connection problem.

Once the user is authenticated and their inventory has been taken care of, you can use the Kongregate Client API to allow the user to purchase items from your in-game store. When you request a purchase using the API, our standard shopping cart UI will appear over your game, and you will be notified if the purchase was successful or not. If the purchase is successful, the server should be instructed to update the player's inventory and award any items.

Uploading your game

You should upload your game to Kongregate, but keep it in the preview state. Next, email ben@kongregate.com to let me know so that I can give you some Kreds as well as granting your game special permissions since some of these APIs are not public yet. Note that only games which have been selected to participate in the microtransaction test phase will get a response, as these features are still in closed beta.

In this email, make sure to let me know your account name along with the game you want permissions granted on, along with any other accounts you would like Kreds donated to for testing.

You should leave your game in the preview state until it is fully tested.

Authentication Integration

If you have a game server that needs to query our back-end for authentication or item information, then you should read the documentation for the Web Services API. Specifically, take a look at the authentication web service.

This covers obtaining your API key, client integration, and the Authentication API.

Microtransaction Integration

If you will be implementing the Microtransactions/Kreds API, you should read over the documentation which will cover how to set up your item store, along with how to query item information from your game.

Handling Guests

Since guest users on Kongregate are not allowed to purchase or spend Kreds, your game will need to handle guests in a special fashion. For example, if a user wants to purchase items in your store, you will need to tell them to sign in or create a Kongregate account.

If you are implementing the authentication API, it is typically a good idea to try to upsell the user on the benefits of signing into Kongregate, including letting them know that they wont have to create an account for your game if they do so.

You can find documentation on how to handle guests in your games (including information on how to view your own game as a guest while it is in the preview state for testing) here.

IFrame integration

If your game is hosted on a non-Kongregate domain via an iframe, you will need to perform some additional work before things will function properly. An overview of the process can be found here

Documentation