Steamworks Link and Login

Another method similar to the Google and Facebook Link/Login methods, linking your Steam account with your ChilliConnect account ensures you do not lose any Player data when switching device, or during a re-install.

This tutorial covers the following:

  • Setting up the Steamworks configuration in Dashboard, and where to get the needed information.
  • Attaching a Steam Account to a ChilliConnect account to allow for Steam logins (using Steamworks.NET).

Configuring ChilliConnect with Steamworks App Details

This tutorial assumes the developer has administrative access to the Steamworks Partner information screen, in particular the 'Manage Groups' page that lists the User Groups.

This page will allow you to generate a Web API Key which you will need to take a copy of. The other piece of information you need is the 6 digit ApplicationID shown in brackets next to your Game Name on several pages.

With these two piece of information copied, open up the ChilliConnect Dashboard. Under the Game heading, navigate to the Settings tab and scroll down to the Steam Authentication Details. Input the previously copied Steam Api Key and ApplicationID here.

That's all the configuration that ChilliConnect needs to start authenticating Session Tickets.

Steamworks.NET is a .unitypackage developed in order to make it easy to integrate with Steamworks services. Steamworks.NET can be used in a plain C#, but this tutorial assumes the Developer is using Unity.

To begin, import the Steamworks.NET Unity package into your Unity game. In the root of your project should be a text file name steam_appid.txt, open this and replace the number that is there with the AppID that you noted down from the previous step.

Create or Edit a class where you want to perform the request to Steamworks Authentication and include the Steamworks package with

using Steamworks;

We will need three private variables to store the components of the Session Ticket before we format and send it up to ChilliConnect. The formatting will be covered later but for now we need to initialise these variables.

    private byte[] m_Ticket;
    private uint m_pcbTicket;
    private HAuthTicket m_HAuthTicket;

It is recommended by Steamworks documentation to handle the response of GetAuthSessionTicket in a callback, so that the Steamworks Servers have time to validate if the Player belongs to the specified Game. This can take upwards of 10 seconds in some cases. Define and enter the following Callback function as so:

    protected Callback<GetAuthSessionTicketResponse_t> m_GetAuthSessionTicketResponse;

    void OnGetAuthSessionTicketResponse(GetAuthSessionTicketResponse_t pCallback) {

        //Resize to buffer of 1024
        System.Array.Resize(ref m_Ticket, (int)m_pcbTicket);

        //format as Hex 
        System.Text.StringBuilder sb = new System.Text.StringBuilder();

        foreach (byte b in m_Ticket) {
            sb.AppendFormat ("{0:x2}", b);

        UnityEngine.Debug.Log ("Hex encoded ticket: " + sb.ToString());

This callback also contains the code for formatting the returned SessionTicket to a UTF8 Hexcode, so passing the result into here will have the formatted Session Ticket ready to go.

The actual code snippet to call GetAuthSessionTicket is quite simple, make a call to the SteamUser.GetAuthSessionTicket() method, and when this had processed, the code snippet from earlier will recognise this as an event and display the SessionTicket in the format that ChilliConnect needs.

    if(SteamManager.Initialized) {
        m_GetAuthSessionTicketResponse = Callback<GetAuthSessionTicketResponse_t>.Create(OnGetAuthSessionTicketResponse);

        m_Ticket = new byte[1024];
        m_HAuthTicket = SteamUser.GetAuthSessionTicket(m_Ticket, 1024, out m_pcbTicket);

Now that the Session Ticket has been retrieved and formatted, it can be used in the LinkSteamAccount method and LogInWithSteam.