diff --git a/Assets/_Scripts/Utilities/HttpClient.cs b/Assets/_Scripts/Utilities/HttpClient.cs index 27fe230..de430c7 100644 --- a/Assets/_Scripts/Utilities/HttpClient.cs +++ b/Assets/_Scripts/Utilities/HttpClient.cs @@ -6,6 +6,8 @@ using UnityEngine.Networking; public static class HttpClient { + private static string _jwt = ""; + public static async Task Get(string endpoint) { var getRequest = CreateRequest(endpoint, RequestType.GET); @@ -39,6 +41,11 @@ public static class HttpClient return JsonConvert.DeserializeObject(postRequest.downloadHandler.text); } + public static void SetJwt(string jwt) + { + _jwt = jwt; + } + private static UnityWebRequest CreateRequest(string path, RequestType type, object data = null) { var request = new UnityWebRequest(path, type.ToString()); @@ -51,6 +58,7 @@ public static class HttpClient request.downloadHandler = new DownloadHandlerBuffer(); request.SetRequestHeader("Content-Type", "application/json"); + request.SetRequestHeader("Authorization", $"Bearer {_jwt}"); request.certificateHandler = new CertificateWhore();