Steam Sign-In¶
In order to integrate Steam into any game you have to use the Steamworks SDK and the Steamworks API. This section will show you how to properly integrate the Steamworks SDK into a Unity Game. However, the implementations of Steamworks are relatively the same across various languages.
Install the Steamworks.NET SDK into your project.
The Steamworks.NET SDK is a wrapper around the Steamworks SDK provided from Steam (Valve). You'll need to download the Latest SDK and install it into your project. Thankfully, it's only a Unity package and you can just import it into Unity like any other package.
In this guide, you will learn the key components to integrating Steam and Beamable.
Authentication¶
Primarily we use the Steamworks SDK to acquire the Steam Token for Authentication. This same token is also used for purchases through steam. For Authentication as shown below, we use the token to validate it with Beamable, and once that has been accomplished we use the token result to then Login, Create or Attach the User in Steam to Beamable.
Steam AppID Setup¶
You'll need an AppID, which you can acquire from Steam. If you do not have one, you will need to create a new app in the Steam Partner Portal. Once you've created your app, you can find its AppID, which will be a numeric value after the name of your Steam app.
Example: MyAppName (1234567)
You then need to place this AppID in a file that was installed in the root of your project folder. This file is called steam_appid.txt. The root of your project is located in the folder above your Assets folder. It should look like the following, with only the AppID present in the file steam_appid.txt: 1234567
Setup In Portal¶
There are some additional steps in order to configure Beamable for Steam Integration. You'll need to register your Web API key and AppID in the Beamable portal at https://portal.beamable.com/
Once you have done this, you can verify that the Steamworks SDK is working by creating any MonoBehaviour and outputting the Steam User ID to the console.
Log in to [Steam Partner Portal] and use the dropdown option to Manage Groups. In your main group, you will need to create a Web API Key if you have not created one yet. It will be located as an option in the right-hand side bar. If you have already created one, then it will be displayed in the side bar as well.
Follow these steps in the Beamable Portal:
| Step | Action |
|---|---|
| 1 | Log in to Beamable Portal |
| 2 | Navigate to the Realm Configuration page |
| 3 | Create a new Key in the configuration by clicking on +Config and name it "steam" (all lower-case) in the namespace field |
| 4 | Create 3 KVP values: sandbox, appid, key |
| 5 | Enter "true" for the sandbox value |
| 6 | Use your Steam AppID for the appid value |
| 7 | Enter your WebAPI key for the key value |
While the above steps are not needed to test that the Steamworks SDK is working, they are critical in order for the Beamable Steam integration to work properly. Note that you will also need to have a GameObject with the SteamManager script (from the Steamworks.NET Example repository) attached.
1 2 3 4 | |
You should see that your Steam ID is printed to the console.
Using Steamworks
Be sure to include the Steamworks.NET SDK in the files you are working with.
using Steamworks;
Getting Steam Session Ticket¶
You'll need to acquire a Steam Session Ticket to validate. In the example below, we are using the SteamUser.GetAuthSessionTicket() function of the Steamworks SDK to accomplish this. You can copy and paste the following into your code as-is to get your Steam Session Ticket:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | |
You can then call this promise as an async/await task:
1 | |
Using the Steam Auth Session Ticket with Beamable¶
One next step you can take is to validate the Session Ticket with Beamable. Beamable will return whether that ticket is valid or not. You can use the function below as-is:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | |
You can call this promise using async/await:
1 | |
Login to Beamable with 3rd Party (Steam)¶
Much like our other 3rd Party authentication methods, you will use the three main functions in the Beamable SDK: LoginThirdParty, RegisterThirdPartyCredentials, CreateUser.
To use these services, you must convert the Steam Auth Ticket to the proper format in order for Beamable to recognize it.
1 2 3 4 | |
In the following sections, you will see that we use the above code to convert the ticket to a Beamable token.
Handle Various Flow Scenarios¶
Now that we have the Steam Session Token, we need to account for 3 different scenarios:
New Player
Returning Player already linked to Steam
Returning Player linking their account with Steam
We can tell which of these scenarios to follow by checking two pieces of information: whether the Steam ID is already attached to a Beamable account and whether the current, local account has a Steam 3rd party association.
- If the Steam ID is already associated with a Beamable account, the game should log into that account (which may or may not be the current Beamable account).
- Otherwise, if the Steam ID has never been used with Beamable before, there are two possibilities:
- If the local account has a Steam association, then the current Steam ID must be different and thus a new Beamable account should be made.
- If the local account has no Steam association, this must be their first time logging in with Steam; the Steam ID should be associated with the current Beamable account.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | |
Below you will find the three helper functions: LoginUsingSteam, CreateNewBeamableUser, and RegisterSteamToCurrentUser
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | |
1 2 3 4 5 6 7 8 9 | |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | |
Putting it all together¶
In the Start method of your MonoBehaviour, you can do something like the following:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | |
Purchasing & Payments¶
Beamable also has integrated Purchasing and Payments with Steam. You can issue a request to purchase an item and then pay for that item on the Steam platform. Once the purchase has completed the content is granted to the player from Beamable.




