From fb467ef62600684e3eef71a4ae44bdf6d06236f4 Mon Sep 17 00:00:00 2001 From: Ondrej Rehacek Date: Mon, 19 Aug 2024 19:38:06 +0200 Subject: [PATCH] Add device and build data to request headers Add device and build data to Stash request headers. --- .../Stash.Sample/Scripts/DeeplinkExample.cs | 15 +++++++++++- Assets/Stash/Scripts/Core/RestClient.cs | 24 +++++++++++++++++-- Assets/Stash/Scripts/Core/StashConstants.cs | 3 +++ Assets/Stash/Scripts/Core/StashCustomLogin.cs | 4 ++-- 4 files changed, 41 insertions(+), 5 deletions(-) diff --git a/Assets/Stash.Sample/Scripts/DeeplinkExample.cs b/Assets/Stash.Sample/Scripts/DeeplinkExample.cs index 63b5aa0..dc0ac79 100644 --- a/Assets/Stash.Sample/Scripts/DeeplinkExample.cs +++ b/Assets/Stash.Sample/Scripts/DeeplinkExample.cs @@ -3,6 +3,7 @@ using Stash.Core; using Stash.Core.Exceptions; using Stash.Models; +using Stash.Scripts.Core; using TMPro; using UnityEngine; @@ -38,9 +39,21 @@ private void Awake() } } - private void Start() + private async void Start() { + Debug.Log("TRYING "); + try + { + LinkResponse response = await StashCustomLogin.LinkFacebook("LINK_CODE", "PLAYER_ID", "FB_APPID", "ACCESS_TOKEN", StashEnvironment.Test); + + } + catch (StashRequestError e) + { + Console.WriteLine(e); + throw; + } + } diff --git a/Assets/Stash/Scripts/Core/RestClient.cs b/Assets/Stash/Scripts/Core/RestClient.cs index af5a545..ed6f3d1 100644 --- a/Assets/Stash/Scripts/Core/RestClient.cs +++ b/Assets/Stash/Scripts/Core/RestClient.cs @@ -1,7 +1,9 @@ +using System; using System.Collections.Generic; using System.Text; using System.Threading.Tasks; using Stash.Models; +using UnityEngine; using UnityEngine.Networking; namespace Stash.Core @@ -80,11 +82,29 @@ public static async Task Post(string url, string body, IEnumerableStash code challenge from the log in deeplink. /// Player identification, that will be used to identify purchases. /// Valid identification token (OICD) of the player. - /// URL to the player's profile image/avatar to be displayed during login and on web shop. + /// Profile image url of the player. /// Stash API environment (Defaults to Test). /// Returns a confirmation response, or throws StashAPIRequestError if fails. - public static async Task CustomLogin(string code, string playerId, string idToken, string profileImageUrl, StashEnvironment environment = StashEnvironment.Test) + public static async Task CustomLogin(string code, string playerId, string idToken, string profileImageUrl = null, StashEnvironment environment = StashEnvironment.Test) { // Create the authorization header with the access token RequestHeader authorizationHeader = new()