diff --git a/Assets/Treasure/TDK/Runtime/API/Auth.cs b/Assets/Treasure/TDK/Runtime/API/Auth.cs index fab26b05..c98fe5b3 100644 --- a/Assets/Treasure/TDK/Runtime/API/Auth.cs +++ b/Assets/Treasure/TDK/Runtime/API/Auth.cs @@ -42,8 +42,13 @@ public struct GetAuthPayloadResponse [Serializable] public struct LogInBody { - public AuthPayload payload; - public string signature; + public struct Payload + { + public AuthPayload payload; + public string signature; + } + + public Payload payload; } [Serializable] @@ -73,7 +78,6 @@ public struct Signer public partial class API { - [Obsolete("GetAuthPayload is deprecated. Use GetLoginPayload.")] public async Task GetAuthPayload(string address, string chainId) { var response = await Post("/auth/payload", JsonConvert.SerializeObject(new GetAuthPayloadBody() @@ -84,18 +88,15 @@ public async Task GetAuthPayload(string address, string chainId) return JsonConvert.DeserializeObject(response).payload; } - public async Task GetLoginPayload(string address) - { - var response = await Get($"/login/payload?address={address}"); - return JsonConvert.DeserializeObject(response); - } - public async Task LogIn(AuthPayload payload, string signature) { - var response = await Post("/login", JsonConvert.SerializeObject(new LogInBody() + var response = await Post("/auth/login", JsonConvert.SerializeObject(new LogInBody() { - payload = payload, - signature = signature, + payload = new LogInBody.Payload() + { + payload = payload, + signature = signature, + } })); return JsonConvert.DeserializeObject(response).token; } diff --git a/Assets/Treasure/TDK/Runtime/Identity/TDK.Identity.cs b/Assets/Treasure/TDK/Runtime/Identity/TDK.Identity.cs index 30caa17c..765d3ae8 100644 --- a/Assets/Treasure/TDK/Runtime/Identity/TDK.Identity.cs +++ b/Assets/Treasure/TDK/Runtime/Identity/TDK.Identity.cs @@ -205,7 +205,8 @@ public async Task StartUserSession(Project project) // Create auth token TDKLogger.Log("Fetching login payload"); - var payload = await TDK.API.GetLoginPayload(address); + var chainId = (int)await GetChainId(); + var payload = await TDK.API.GetAuthPayload(address, chainId.ToString()); TDKLogger.Log("Signing login payload"); var signature = await GenerateSignature(payload); diff --git a/Assets/Treasure/TDK/Runtime/TDKVersion.cs b/Assets/Treasure/TDK/Runtime/TDKVersion.cs index eb0f73c3..cf6c4da9 100644 --- a/Assets/Treasure/TDK/Runtime/TDKVersion.cs +++ b/Assets/Treasure/TDK/Runtime/TDKVersion.cs @@ -3,6 +3,6 @@ public static class TDKVersion { public static string name = "tdk-unity"; - public static string version = "0.3.2"; + public static string version = "0.3.3"; } }