Skip to content

Commit

Permalink
Add support for specifying the steam app id on verification requests
Browse files Browse the repository at this point in the history
  • Loading branch information
Erik Bylund committed May 15, 2024
1 parent 928452c commit fdcfde6
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 1 deletion.
22 changes: 21 additions & 1 deletion Runtime/Game/LootLockerSDKManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,27 @@ public static bool CheckInitialized(bool skipSessionCheck = false)

#region Authentication
/// <summary>
/// Verify the player's steam identity with the server. You can read more on how to setup Steam with LootLocker here; https://docs.lootlocker.com/how-to/authentication/steam
/// Verify the player's steam identity with the server for the specified steam app id.
///
/// You can read more on how to setup Steam with LootLocker here; https://docs.lootlocker.com/how-to/authentication/steam
/// </summary>
/// <param name="steamSessionTicket">A steamSessionTicket in string-format</param>
/// <param name="steamAppId">The steam app id to verify this player for</param>
/// <param name="onComplete">onComplete Action for handling the response of type LootLockerVerifyResponse</param>
public static void VerifySteamID(string steamSessionTicket, int steamAppId, Action<LootLockerVerifyResponse> onComplete)
{
if (!CheckInitialized(true))
{
onComplete?.Invoke(LootLockerResponseFactory.SDKNotInitializedError<LootLockerVerifyResponse>());
return;
}
LootLockerAPIManager.VerifyWithAppId(steamSessionTicket, steamAppId, onComplete);
}

/// <summary>
/// Verify the player's steam identity with the server.
///
/// You can read more on how to setup Steam with LootLocker here; https://docs.lootlocker.com/how-to/authentication/steam
/// </summary>
/// <param name="steamSessionTicket">A steamSessionTicket in string-format</param>
/// <param name="onComplete">onComplete Action for handling the response of type LootLockerVerifyResponse</param>
Expand Down
22 changes: 22 additions & 0 deletions Runtime/Game/Requests/LootLockerVerifyRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,17 @@ public LootLockerVerifySteamRequest(string token) : base(token)
}
}

public class LootLockerVerifySteamWithAppIdRequest : LootLockerVerifySteamRequest
{
public int active_steam_app_id { get; set; }

public LootLockerVerifySteamWithAppIdRequest(string token, int appId) : base(token)
{
this.token = token;
this.active_steam_app_id = appId;
}
}

public class LootLockerVerifyResponse : LootLockerResponse
{
}
Expand All @@ -47,5 +58,16 @@ public static void Verify(LootLockerVerifyRequest data, Action<LootLockerVerifyR

LootLockerServerRequest.CallAPI(endPoint.endPoint, endPoint.httpMethod, json, (serverResponse) => { LootLockerResponse.Deserialize(onComplete, serverResponse); }, false);
}
public static void VerifyWithAppId(string token, int appId, Action<LootLockerVerifyResponse> onComplete)
{
if (string.IsNullOrEmpty(token))
{
onComplete?.Invoke(LootLockerResponseFactory.InputUnserializableError<LootLockerVerifyResponse>());
return;
}
EndPointClass endPoint = LootLockerEndPoints.playerVerification;

LootLockerServerRequest.CallAPI(endPoint.endPoint, endPoint.httpMethod, LootLockerJson.SerializeObject(new LootLockerVerifySteamWithAppIdRequest(token, appId)), (serverResponse) => { LootLockerResponse.Deserialize(onComplete, serverResponse); }, false);
}
}
}

0 comments on commit fdcfde6

Please sign in to comment.