Native API Flow
The Native API allows for smooth integration of single sign-on with a user's Kongregate account. Some special considerations do need to be taken into account however, since this authentication requires that the Kongregate Client also be installed. When your game starts up, it needs to use the API to detect the Kongregate Client, and prompt the user to install it if it is not already. Below are some diagrams demonstrating situations where UI will need to be implemented.
Note that we also provide a higher level API call that can handle much of this work for you:
initializeKongregateAccount is a blocking call that will present an interface to the user prompting them to install the Kongregate Client and sign into a Kongregate account.
Kongregate Client is not installed
If the Kongregate Client isn't installed, you should prompt the user to install it. The Native API provides functions for detecting the installation, and for launching an external browser to a page that contains more information about the client.
Waiting for the API to initialize
When you initialize the API, it will automatically initiate communication with the Kongregate Client application. In some cases the client app may not be running, in which case it will be started automatically. If the user is logged in to their Kongregate account, a web service call is made to obtain an authentication token as well. You should display a message to the user letting them know that the connection to Kongregate is being initialized.
Player is not logged in
If the player is not logged into their Kongregate account, you may want to prompt them to sign in or register. The API provides a call to initiate sign-in/registration. If your game allows users to play as a guest without authentication (recommended), you may also allow the player to just get started as a guest.
Once the API provides you with an authentication token for the Kongregate user, you can use our REST web services to authenticate the user on your server.
Requesting additional information/Linking accounts
If your game requires it, you can request additional information about the user, or allow them to set a password for their account on your servers. We do request that if the user's Kongregate username is available in your system you automatically use that as a username.