Skip to content

Commit 100ebda

Browse files
Erik Bylundkirre-bylund
authored andcommitted
Add support for specifying the steam app id on verification requests
1 parent 208a042 commit 100ebda

File tree

2 files changed

+43
-1
lines changed

2 files changed

+43
-1
lines changed

Runtime/Game/LootLockerSDKManager.cs

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,27 @@ public static bool CheckInitialized(bool skipSessionCheck = false)
119119

120120
#region Authentication
121121
/// <summary>
122-
/// 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
122+
/// Verify the player's steam identity with the server for the specified steam app id.
123+
///
124+
/// You can read more on how to setup Steam with LootLocker here; https://docs.lootlocker.com/how-to/authentication/steam
125+
/// </summary>
126+
/// <param name="steamSessionTicket">A steamSessionTicket in string-format</param>
127+
/// <param name="steamAppId">The steam app id to verify this player for</param>
128+
/// <param name="onComplete">onComplete Action for handling the response of type LootLockerVerifyResponse</param>
129+
public static void VerifySteamID(string steamSessionTicket, int steamAppId, Action<LootLockerVerifyResponse> onComplete)
130+
{
131+
if (!CheckInitialized(true))
132+
{
133+
onComplete?.Invoke(LootLockerResponseFactory.SDKNotInitializedError<LootLockerVerifyResponse>());
134+
return;
135+
}
136+
LootLockerAPIManager.VerifyWithAppId(steamSessionTicket, steamAppId, onComplete);
137+
}
138+
139+
/// <summary>
140+
/// Verify the player's steam identity with the server.
141+
///
142+
/// You can read more on how to setup Steam with LootLocker here; https://docs.lootlocker.com/how-to/authentication/steam
123143
/// </summary>
124144
/// <param name="steamSessionTicket">A steamSessionTicket in string-format</param>
125145
/// <param name="onComplete">onComplete Action for handling the response of type LootLockerVerifyResponse</param>

Runtime/Game/Requests/LootLockerVerifyRequest.cs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,17 @@ public LootLockerVerifySteamRequest(string token) : base(token)
2626
}
2727
}
2828

29+
public class LootLockerVerifySteamWithAppIdRequest : LootLockerVerifySteamRequest
30+
{
31+
public int active_steam_app_id { get; set; }
32+
33+
public LootLockerVerifySteamWithAppIdRequest(string token, int appId) : base(token)
34+
{
35+
this.token = token;
36+
this.active_steam_app_id = appId;
37+
}
38+
}
39+
2940
public class LootLockerVerifyResponse : LootLockerResponse
3041
{
3142
}
@@ -47,5 +58,16 @@ public static void Verify(LootLockerVerifyRequest data, Action<LootLockerVerifyR
4758

4859
LootLockerServerRequest.CallAPI(endPoint.endPoint, endPoint.httpMethod, json, (serverResponse) => { LootLockerResponse.Deserialize(onComplete, serverResponse); }, false);
4960
}
61+
public static void VerifyWithAppId(string token, int appId, Action<LootLockerVerifyResponse> onComplete)
62+
{
63+
if (string.IsNullOrEmpty(token))
64+
{
65+
onComplete?.Invoke(LootLockerResponseFactory.InputUnserializableError<LootLockerVerifyResponse>());
66+
return;
67+
}
68+
EndPointClass endPoint = LootLockerEndPoints.playerVerification;
69+
70+
LootLockerServerRequest.CallAPI(endPoint.endPoint, endPoint.httpMethod, LootLockerJson.SerializeObject(new LootLockerVerifySteamWithAppIdRequest(token, appId)), (serverResponse) => { LootLockerResponse.Deserialize(onComplete, serverResponse); }, false);
71+
}
5072
}
5173
}

0 commit comments

Comments
 (0)