Windows
This article guides you through setting up Steam as an identity provider, enabling your Windows game to access Player Network authentication services.
Prerequisites
The Steam Web API limits requests to 100,000 per day. For more information on Steam request limits, see Steam Web API Terms of Use.
For players to log in to your Windows game through Steam, they must have the Steam client software installed on their devices and have already logged in to Steam.
- Set up the Steam app on the Steam official website after applying for a developer account to obtain an App ID for the game.
- Create an account for Player Network Console.
- Create a new project for your game, or join an existing one.
- Download the SDK.
- Integrate the SDK.
- Add Steam as an authentication method for your project on Player Network Console.
Step 1: Configure the SDK for Steam login
During the game development stage, do not include any Steam account information, such as STEAM_APPID
, in the INTLConfig.ini
file.
1. Create steam_appid.txt
During the game development stage, if the game has not yet been approved for release in the Steamworks console, create a steam_appid.txt
file with 480
as its only contents and place it inside the executable directory of the game. This is generally the project's Binaries/Win64/
folder, but if Unreal Engine is used, the file should be placed in the same directory as UE4Editor.exe
(or UnrealEditor.exe
), which is the yourEnginePath/Engine/Binaries/Win64
directory.
The steam_appid.txt
file must not contain any other characters or line breaks besides 480
. When your game is set to Coming Soon in Steamworks, delete the steam_appid.txt
file.
For more information, see Initialization and Shutdown within the Steamworks API Overview.
2. Select Steam login method
For Player Network SDK V1.16 and later versions, Player Network SDK supports logging in to Steam through INTLWebView
.
For Player Network SDK V1.21 and later versions, Player Network SDK supports logging in to Steam through the system browser.
- Player Network SDK 1.16 and later
- Before Player Network SDK 1.16
If your game is to be released on Steam, it is recommended to log in by connecting to the Steam client. As Player Network SDK is required to call the Steam client to authenticate players, players must log in to the Steam app before the Player Network SDK authentication.
noteIf the error message "SteamAPI_Init failed. Please check your Steam client status" is shown when the game logs in to the Steam account, check if the Steam client is running and already logged in.
If your game is to be released on channels other than Steam, it is recommended to log in by using either
INTLWebView
or the system browser (supported since Player Network SDK V1.21). When usingINTLWebView
or the system browser to log in to Steam, players are not required to open the Steam client.cautionWhile using the Editor mode on PC, a crash may occur when logging in to Steam with
INTLWebView
. This problem only appears in Editor mode, and will not be present in the packaged PC game.To enable logging in to Steam using
INTLWebView
or the system browser, add the following configurations toINTLConfig.ini
:# For INTLWebView login
STEAM_WEBVIEW_LOGIN_ENABLE = 1
# For system browser login
STEAM_BROWSER_LOGIN_ENABLE = 1- If both
STEAM_WEBVIEW_LOGIN_ENABLE
andSTEAM_BROWSER_LOGIN_ENABLE
are set to 1, onlySTEAM_WEBVIEW_LOGIN_ENABLE
will take effect,INTLWebView
will be used to log in to Steam. - If both
STEAM_WEBVIEW_LOGIN_ENABLE
andSTEAM_BROWSER_LOGIN_ENABLE
are not set, or are set to 0, Player Network SDK will connect to the Steam client to log in.
- If both
Player Network SDK is required to call the Steam client to authenticate players. Therefore, players must log in to the Steam app before the Player Network SDK authentication.
If the error message "SteamAPI_Init failed. Please check your Steam client status" is shown when the game logs in to the Steam account, check if the Steam client is running and already logged in.
Step 2: Add Steam login
Add an observer to handle authentication callbacks.
- Unity
- Unreal Engine
// Add callbacks
public void AddAuthObserver()
{
INTLAPI.AddAuthResultObserver(OnAuthResultEvent);
}
// Remove callbacks
public void RemoveAuthObserver()
{
INTLAPI.RemoveAuthResultObserver(OnAuthResultEvent);
}
// Process the INTLAuthResult callback
public void OnAuthResultEvent(INTLAuthResult ret)
{
Debug.Log($"MethodID: {ret.MethodId}");
string methodTag = "";
if (authRet.MethodId == (int)INTLMethodID.INTL_AUTH_LOGIN)
{
methodTag = "Login";
}
else if (authRet.MethodId == (int)INTLMethodID.INTL_AUTH_BIND)
{
methodTag = "Bind";
}
else if (authRet.MethodId == (int)INTLMethodID.INTL_AUTH_AUTOLOGIN)
{
methodTag = "AutoLogin";
}
else if (authRet.MethodId == (int)INTLMethodID.INTL_AUTH_QUERY_USER_INFO)
{
methodTag = "QueryUserInfo";
}
else if (authRet.MethodId == (int)INTLMethodID.INTL_AUTH_GET_AUTH_RESULT)
{
methodTag = "GetAuthResult";
}
}C++ Event Handling (above v1.15)
//configure callback
FINTLAuthEvent authEvent;
authEvent.AddUObject(this, &OnAuthResult_Implementation);
UINTLSDKAPI::SetAuthResultObserver(authEvent);
// Remove callbacks
UINTLSDKAPI::GetAuthResultObserver().Clear();void OnAuthResult_Implementation(FINTLAuthResult ret)
{
UE_LOG(LogTemp, Warning, TEXT("MethodID: %d"), ret.MethodId);
}Unreal Event Handling
void OnAuthResult_Implementation(FINTLAuthResult ret)
{
UE_LOG(LogTemp, Warning, TEXT("MethodID: %d"), ret.MethodId);
}Call the
AutoLogin
method.- Unity
- Unreal Engine
INTLAPI.AutoLogin();
UINTLSDKAPI::AutoLogin();
Call the
Login
method to ask for user input if auto-login fails.- Unity
- Unreal Engine
INTLAPI.Login(INTLChannel.Steam);
UINTLSDKAPI::Login(EINTLLoginChannel::kChannelSteam);
After logging into Steam, get the user avatar from the
ChannelInfo
of the returnedAuthResult
.channelInfo : {"picture_path":"/path/to/image.png"}
Setting
STEAM_AVATAR_RAW_RGBA_ENABLE
to 1 inINTLConfig
.ini will return the RAW RGBA data of the user avatar.channelInfo : {"picture_path":"/path/to/image.json"}
Sync client authentication state with the game backend and wait for the final authentication result.
Step 3: Test the login function
Search for the keyword "AuthResult" in the Player Network SDK logs to verify if the correct channel name and OpenID are returned. If they are, it indicates a successful configuration and the login function has been added successfully.
If you encounter any problems during the integration process, see FAQ.
Step 4: Release your game
For more information on how to release your game on Steam, see Steamworks Partner Program.
Delete the
steam_appid.txt
file inside the executable directory of the game, or Steam login might fail.Set the
AppID
for Steam channel in Player Network Console to the designatedAppID
of the game. Player Network SDK can now display Steam login correctly.[Optional] If a configuration was modified on Player Network Console after downloading the SDK, the changes may not be synchronized to
INTLConfig.ini
. To ensure your game is launched from the Steam client, configure theSTEAM_APPID
field inINTLConfig.ini
, seeSteamAPI_RestartAppIfNecessary
for more information.
During game launch after configuring the field:- If the game is not run from the directory the Steam client is installed, initialization of Steam related functions will fail.
- If the Steam client is not running, the Steam client will open and be redirected to the game's page.
- If the error message "Please launch app by Steam Client" is shown during login, the game may not be launched properly from the Steam client. Remove
STEAM_APPID
fromINTLConfig.ini
and try again.
[Steam]
STEAM_APPID = {INTL_STEAM_APP_ID}
Replace {INTL_STEAM_APP_ID}
with the Steam app ID of the game.