Skip to main content

Windows

This article guides you through setting up Steam as an identity provider, enabling your Windows game to access Player Network authentication services.

Prerequisites

note

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.

  1. Set up the Steam app on the Steam official website after applying for a developer account to obtain an App ID for the game.
  2. Create an account for Player Network Console.
  3. Create a new project for your game, or join an existing one.
  4. Download the SDK.
  5. Integrate the SDK.
  6. Add Steam as an authentication method for your project on Player Network Console.

Step 1: Configure the SDK for Steam login

note

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

note

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.

  • 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.

    note

    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.

  • 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 using INTLWebView or the system browser to log in to Steam, players are not required to open the Steam client.

    caution

    While 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 to INTLConfig.ini:

    # For INTLWebView login
    STEAM_WEBVIEW_LOGIN_ENABLE = 1
    # For system browser login
    STEAM_BROWSER_LOGIN_ENABLE = 1
    • If both STEAM_WEBVIEW_LOGIN_ENABLE and STEAM_BROWSER_LOGIN_ENABLE are set to 1, only STEAM_WEBVIEW_LOGIN_ENABLE will take effect, INTLWebView will be used to log in to Steam.
    • If both STEAM_WEBVIEW_LOGIN_ENABLE and STEAM_BROWSER_LOGIN_ENABLE are not set, or are set to 0, Player Network SDK will connect to the Steam client to log in.

Step 2: Add Steam login

  1. Add an observer to handle authentication callbacks.

    // 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";
    }
    }
  2. Call the AutoLogin method.

    INTLAPI.AutoLogin();
  3. Call the Login method to ask for user input if auto-login fails.

    INTLAPI.Login(INTLChannel.Steam); 
  4. After logging into Steam, get the user avatar from the ChannelInfo of the returned AuthResult.

    channelInfo : {"picture_path":"/path/to/image.png"}

    Setting STEAM_AVATAR_RAW_RGBA_ENABLE to 1 in INTLConfig.ini will return the RAW RGBA data of the user avatar.

    channelInfo : {"picture_path":"/path/to/image.json"}
  5. 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.

  1. Delete the steam_appid.txt file inside the executable directory of the game, or Steam login might fail.

  2. Set the AppID for Steam channel in Player Network Console to the designated AppID of the game. Player Network SDK can now display Steam login correctly.

  3. [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 the STEAM_APPID field in INTLConfig.ini, see SteamAPI_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 from INTLConfig.ini and try again.
[Steam]
STEAM_APPID = {INTL_STEAM_APP_ID}

Replace {INTL_STEAM_APP_ID} with the Steam app ID of the game.