LootLocker
The BasicsGame SystemsContent ManagementPlayer Management
LootLocker
  • 📌The Basics
    • Getting Started
    • What is LootLocker?
    • Core Concepts
      • Players
      • Assets
      • Character Classes
      • API Types
      • Web Console
      • Stage & Live Environments
      • Glossary
    • Unity Quick Start
      • Install the SDK
      • Configure the SDK
      • Authenticate Your First Player
      • Update the SDK
    • Unreal Quick Start
      • Install & Configure the SDK
        • Older versions
      • Authenticate Your First Player
    • Godot Quick Start
      • Install the SDK
      • Configure the SDK
      • Authenticate Your First Player
      • Update the SDK
    • SDKs
    • Samples
      • Authentication Samples
      • Leaderboard Samples
      • Progression Samples
      • Player Samples
    • Launching Your Game
    • Support
      • Error Codes
      • Unreal Marketplace Plugin Support
  • 🎭Players
    • Overview
    • Authentication
      • How To
        • Guest Login
        • Steam
        • Apple
        • Apple Game Center
        • Google
        • Epic Games
        • PlayStation
        • Meta / Oculus
        • Xbox
        • Nintendo Switch
    • Files
      • How To
        • Manage Files in Web Console
        • Work with Files In-Game
    • Inventory
      • How To
        • Work with Player Inventory
    • Messages
      • How To
        • Configure Messages in Web Console
    • Names
      • How To
        • Work with Player Names
    • Player Manager
      • How To
        • Manage Players through Web Console
        • Manage Players In-Game
        • Use Player Operations
    • Unified Player Accounts
      • How To
        • Configure UPA in Web Console
        • Use Remote Login In-Game
        • Connect Identiy Provider to Player
        • External Provider Linking
        • Transition from Guest Login to Other Provider
        • Disconnect Identity Provider from Player
    • White Label Login
      • How To
        • Configure White Label Login
        • Create a New White Label User
        • Request User Verification
        • Handle Returning Users
        • Start a White Label Session
  • 🪙Commerce
    • Overview
    • Catalogs
      • How To
        • Configure Catalogs in LootLocker Console
        • List all Catalogs
        • Use Catalogs In-Game
        • Setup In-Game Store
    • Currencies
      • How To
        • Configure a Currency in Web Console
        • Use Currencies In-Game
    • DLC Management
      • How To
        • Configure DLC in Web Console
        • Use DLC In-Game
    • Entitlements
      • How To
        • Work with Entitlements In-Game
    • Real Money Purchases
      • How To
        • Configure In-App Purchase in Web Console
        • Make Purchases through Google Play Store
        • Make Purchases through Apple Store
        • Make Purchases through Steam Store
    • Virtual Purchases
    • Wallets
      • How To
        • Manage a Wallet in Web Console
        • Use Wallets In-Game
  • ⚔️Content
    • Overview
    • Assets
      • How To
        • Create & Configure an Asset
        • Organize & Search for Assets
        • Retrieve Assets In-Game
        • Set up Asset Storage Template
        • Check Grant Notifications
        • Set up a Game Config Asset
        • Create a Loot Box
        • Work with Loot Boxes In-Game
        • Create a Drop Table
        • Work with Drop Tables In-Game
        • Create a Rental Asset
        • Work with Rental Assets In-Game
    • User Generated Content (UGC)
      • How To
        • Create UGC In-Game
    • Twitch Drops
  • 🕹️Game Systems
    • Overview
    • Classes & Heroes
      • How To
        • Base Classes
        • Hero Classes
        • Implement Classes In-Game
        • Implement Heroes In-Game
    • Leaderboards
      • How To
        • Configure Leaderboard in Web Console
        • Use Player Leaderboards
        • Use Generic Leaderboards
        • Use Metadata to Store Additional Information
        • Use Scheduled Reset with Rewards
        • Use Leaderboards for Time Based Rankings
      • Leaderboard FAQ
      • GameMaker References
    • Feedback
      • How To
        • Manage Feedback Categories
        • Create Player Feedback
        • Create UGC Feedback
        • Create Game Feedback
        • View and Manage Feedback
    • Progressions
      • How To
        • Create a Progression
        • Game Progressions
        • Player Progressions
        • Class Progressions
        • Asset Instance Progressions
    • Triggers
      • How To
        • Setup a trigger in the Web Console
        • Invoke trigger from game
  • ⛓️Shared Systems
    • Overview
    • Metadata
      • How To
        • Add Metadata in Console
        • Fetch a Single Metadata In-Game
        • Fetch Metadata In-Game by Tags
        • Fetch Metadata In-Game from Multiple Sources
    • Notifications
      • How To
        • List Notifications and Mark as Read In-Game
  • 🗝️Admin
    • Settings
    • User Settings
    • Organization Settings
    • CORS Allowlist
  • ⭕️ Legacy
    • Deprecations
      • Unity SDK Deprecation Log
        • Version 2.1.5 - Migration to Open UPM
        • Version 2.0.0
      • Unreal SDK Deprecation Log
        • Version 4.0.0
        • Version 3.0.0
    • Legacy Storage
    • Legacy Triggers
      • Activate a trigger
      • Create a trigger
    • Legacy Progressions
      • Create a Progression System
      • Use a Progression System In-Game
Powered by GitBook
On this page
  1. Players
  2. Authentication
  3. How To

Steam

PreviousGuest LoginNextApple

Last updated 2 months ago

To use Steam in your game you must be a registered developer and have a game with

Configure Steam in LootLocker

Go to in the LootLocker Web Console and make sure the Steam platform is enabled.

Steam App ID

To get the Steam App ID you have to log in to the SteamWorks Partner Dashboard.

Steam Publisher Key

Install SteamWorks in Your Project

Before we can authenticate with Steam and start a LootLocker session we must have access to a few values from the SteamWorks API.

Our recommended way to gain access to the SteamWorks API in a Unity Game is by using the 3rd party library called Steamworks.NET

To learn now to configure your game to work with Steam, please follow the directions found here:

Authenticate Player

After adding SteamWorks integration in your project you can go ahead and authenticate the player. If successful, this call will return a lot of data that you can use to display to the Player or make more calls to LootLocker during this session.

We'll start by creating a new empty Game Object in your scene and calling it GameManager. Feel free to skip this if you already have a GameManager or similar in your game.

In this new GameObject you can add a new script called GameManager.

Open up your new script in your editor of choice and add the following code:

using LootLocker.Requests;
using Steamworks;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using UnityEngine;

public class NewBehaviourScript : MonoBehaviour
{
    // Consider offsetting this from the start method to avoid startup race conditions
    void Start()
    {
        // To make sure Steamworks.NET is initialized
       if (!SteamManager.Initialized)
        {
            return;
        }
        
        var ticket = new byte[1024];
        var networkIdentity = new SteamNetworkingIdentity();
        HAuthTicket ticketResult = SteamUser.GetAuthSessionTicket(ticket, ticket.Length, out uint actualTicketSize, ref networkIdentity);
        if (ticket.Equals(HAuthTicket.Invalid))
        {
            Debug.LogWarning("Ticket from Steam was invalid: " + ticket.ToString());
            yield break;
        }

        LootLockerSDKManager.VerifyPlayerAndStartSteamSession(ref ticket, actualTicketSize, (response) =>
        {
            if (!response.success)
            {
                Debug.Log("Error starting a LootLocker session from the Steam User: " + response.errorData.ToString());
                return;
            }
            
            Debug.Log("Successfully started a LootLocker session from Steam User with ID: " + SteamID.ToString());
        });
}

Retrieve the Steam Session Ticket

Create a new UClass called USteamSessionHelper like this (this is the .h file):

#pragma once

#include "CoreMinimal.h"

#include "SteamSessionHelper.generated.h"

UCLASS(Blueprintable)
class USteamSessionHelper : public UObject
{
    GENERATED_BODY()
public:
    UFUNCTION(BlueprintCallable, CallInEditor, Category = "<YourProjectName> | SteamSessionHelper")
    static FString GetSteamSessionTicket(int LocalUserNumber);
};

Paste the following code in the .cpp file:

// Copyright (c) 2021 LootLocker

#include "SteamSessionHelper.h"

#include "Interfaces/OnlineIdentityInterface.h"
#include "OnlineSubsystem.h"

FString USteamSessionHelper::GetSteamSessionTicket(int LocalUserNumber)
{
    const IOnlineSubsystem* OnlineSubsystem = IOnlineSubsystem::Get(STEAM_SUBSYSTEM);
    if (OnlineSubsystem == nullptr || OnlineSubsystem->GetSubsystemName() != STEAM_SUBSYSTEM)
    {
	//Handle error: "Could not get Steam Online Subsystem"
	return "";
    }

    const IOnlineIdentityPtr IdentityInterface = OnlineSubsystem->GetIdentityInterface();
    if (IdentityInterface == nullptr || !IdentityInterface.IsValid())
    {
	//Handle error: "Could not get Steam Online Subsystem Identity Interface"
	return "";
    }
    
    if(IdentityInterface->GetLoginStatus(LocalUserNumber) != ELoginStatus::LoggedIn)
    {
        //Handle error: "Player is not logged in"
	return "";
    }

    return IdentityInterface->GetAuthToken(LocalUserNumber);
}

Generate Visual Studio project files and build the project.

You can now use these new methods to get the Steam session ticket from either blueprints or code.

Verify the Player and Start a LootLocker session

In Blueprint you can retrieve the token by finding the node you just made above: GetSteamSessionTicket in the <YourProjectName> | SteamSessionHelper category. This is static so you can find it by right-clicking anywhere within the Event Graph.

Then you can pass the SteamSessionTicket to the Start Steam Session Using Ticket node which you can find by right-clicking anywhere within the Event Graph.

Input

You need to exchange the TriggerSteamAuthentication event for whatever event you want to use to trigger the login flow.

This example does not include the nodes you made above to get the steam id and session ticket. So make sure to utilize those if you made them. If you're getting the values another way, then that's fine. Simply plug the values into the Verify Player and Start Steam Session node.

Output

We recommend branching the completed events on the success flag, and if you do this you will probably want to add error handling in case the request fails as well as what (if any) continued actions you want on success.

The session response on a successful call also contains a lot of interesting information that you likely want to save, such as player_id, public_uid, and player_ulid among others.

You can not test authentication with Steam in the editor. You need to package your game before it can connect to Steam.


var auth_ticket = Steam.getAuthSessionTicket()
if !auth_ticket.has('buffer'):
    printerr("Steam Auth Session Ticket retrieval failed")
    # Handle error as fit in your code
    
var authTicketString : String = LL_Authentication.ParseSteamAuthTicket(auth_ticket['buffer'], auth_ticket['size'])
if authTicketString.is_empty():
    printerr("Auth ticket could not be parsed")
    # Handle error as fit in your code
    
var steamLoginResponse = await LL_Authentication.SteamSession.new(authTicketString).send()
if(!steamLoginResponse.success) :
    printerr("Login failed with reason: " + steamLoginResponse.error_data.to_string(), true)
    # Handle error as fit in your code
print("Successfully started Steam session with LootLocker")

To confirm that everything is running without errors, you can start your game and check the console for the correct message in the log.

To find the Steam Publisher Key you can follow from Valve.

To learn more about authentication with Steam you can read their documentation for .

Install Steamworks.NET using the instructions found here:

To learn now to configure your game to work with Steam, please follow the .

The following steps will help you to retrieve the SteamSessionTicket from the Online Subsystem that you set up in .

To copy and paste the above example into your editor, .

Follow the on how to . Once Steam is properly initialized, open up the script from which you want to trigger LootLocker Authentication in Godot and add the following code.

Congratulations - you have now started using LootLocker in your game with Steam! Next up we suggest you look at our and decide which ones you want to use in your game.

🎭
this guide
Session Tickets in SteamWorks
http://steamworks.github.io/installation/
Unreal Documentation v4.27 and below
Unreal Documentation v5.0 and up
directions from the official GodotSteam documentation
look here
guide from GodotSteam
initialize Steam
the previous step
SteamWorks
Platform Settings
feature set,
LootLocker Steam Settings
The App ID is behind the red square
Creating empty GameObject
Create new script on GameObject
Example implementation in Unreal Blueprints for Steam Player Verification and Session Start using LootLocker - https://blueprintue.com/blueprint/lup-8wln/
Blueprint example of verifying a steam player and starting a steam session