diff --git a/.idea/.idea.stash-unity/.idea/.gitignore b/.idea/.idea.stash-unity/.idea/.gitignore
new file mode 100644
index 0000000..ea46407
--- /dev/null
+++ b/.idea/.idea.stash-unity/.idea/.gitignore
@@ -0,0 +1,10 @@
+# Default ignored files
+/shelf/
+/workspace.xml
+# Rider ignored files
+/modules.xml
+/.idea.stash-unity.iml
+/contentModel.xml
+/projectSettingsUpdater.xml
+# Editor-based HTTP Client requests
+/httpRequests/
diff --git a/.idea/.idea.stash-unity/.idea/indexLayout.xml b/.idea/.idea.stash-unity/.idea/indexLayout.xml
new file mode 100644
index 0000000..7b08163
--- /dev/null
+++ b/.idea/.idea.stash-unity/.idea/indexLayout.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/.idea.stash-unity/.idea/vcs.xml b/.idea/.idea.stash-unity/.idea/vcs.xml
new file mode 100644
index 0000000..35eb1dd
--- /dev/null
+++ b/.idea/.idea.stash-unity/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Assets/Samples/Dependencies/GooglePlayGames/com.google.play.games/Runtime/Scripts/GameInfo.cs b/Assets/Samples/Dependencies/GooglePlayGames/com.google.play.games/Runtime/Scripts/GameInfo.cs
index f9e238f..a3e33f4 100644
--- a/Assets/Samples/Dependencies/GooglePlayGames/com.google.play.games/Runtime/Scripts/GameInfo.cs
+++ b/Assets/Samples/Dependencies/GooglePlayGames/com.google.play.games/Runtime/Scripts/GameInfo.cs
@@ -38,7 +38,7 @@ public static class GameInfo {
public const string ApplicationId = "1045293753265"; // Filled in automatically
public const string IosClientId = "__IOS_CLIENTID__"; // Filled in automatically
- public const string WebClientId = "1045293753265-ejh4ifdimiqfqhj2msj2c3h7oib9r7aq.apps.googleusercontent.com"; // Filled in automatically
+ public const string WebClientId = ""; // Filled in automatically
public const string NearbyConnectionServiceId = "";
public static bool ApplicationIdInitialized() {
diff --git a/Assets/Stash/Scripts/Core/StashClient.cs b/Assets/Stash/Scripts/Core/StashClient.cs
index 24c09c8..91cd9ef 100644
--- a/Assets/Stash/Scripts/Core/StashClient.cs
+++ b/Assets/Stash/Scripts/Core/StashClient.cs
@@ -62,6 +62,60 @@ public static async Task LinkAccount(string challenge, string play
}
}
+ ///
+ /// Links the player's account to Stash account for Apple Account & Google Account.
+ ///
+ ///
+ /// Stash code challenge from the deeplink.
+ /// Player identification, that will be used to identify purchases.
+ /// Valid JWT token of the player.
+ /// Returns a confirmation response, or throws StashAPIRequestError if fails.
+ public static async Task LinkCustom(string challenge, string playerId, string idToken)
+ {
+ // Create the authorization header with the access token
+ RequestHeader authorizationHeader = new()
+ {
+ Key = "Authorization",
+ Value = "Bearer " + idToken
+ };
+
+ // Create the request body with the challenge and internal user id
+ var requestBody = new LinkBody()
+ {
+ codeChallenge = challenge,
+ user = new LinkBody.User
+ {
+ id = playerId
+ }
+ };
+
+ // Set the URL for the link account endpoint
+ const string requestUrl = StashConstants.RootUrlTest + StashConstants.LinkCustomAccount;
+ // Make a POST request to link the access token
+ Response result = await RestClient.Post(requestUrl, JsonUtility.ToJson(requestBody), new List { authorizationHeader });
+
+ // Check the response status code
+ if (result.StatusCode == 200)
+ {
+ try
+ {
+ // Parse the response data into a LinkResponse object
+ LinkResponse resultResponse = JsonUtility.FromJson(result.Data);
+ return resultResponse;
+ }
+ catch
+ {
+ // Throw an error if there is an issue parsing the response data
+ throw new StashParseError(result.Data);
+ }
+ }
+ else
+ {
+ // Throw an error if the API request was not successful
+ throw new StashRequestError(result.StatusCode, result.Data);
+ }
+ }
+
///
/// Links an Apple Game Center account to the Stash user's account.
/// Requires a valid response (signature, salt, timestamp, publicKeyUrl) received from GameKit "fetchItems" no older than 1 hour.
@@ -160,6 +214,7 @@ public static async Task LinkGooglePlayGames(string challenge, str
{
try
{
+ Debug.Log("[RESPONSE RAW] " + result.Data);
LinkResponse resultResponse = JsonUtility.FromJson(result.Data);
return resultResponse;
}
diff --git a/Assets/Stash/Scripts/Core/StashConstants.cs b/Assets/Stash/Scripts/Core/StashConstants.cs
index a3220d4..6c4bde6 100644
--- a/Assets/Stash/Scripts/Core/StashConstants.cs
+++ b/Assets/Stash/Scripts/Core/StashConstants.cs
@@ -6,6 +6,7 @@ public class StashConstants
public const string RootUrlTest = "https://test-api.stash.gg";
public const string LinkAccount = "/sdk/link_code/link";
+ public const string LinkCustomAccount = "/sdk/custom_login/approve";
public const string LinkAppleGameCenter = "/sdk/link_code/link_apple_game_center";
public const string LinkGooglePlayGames = "/sdk/link_code/link_google_play";
}
diff --git a/ProjectSettings/GooglePlayGameSettings.txt b/ProjectSettings/GooglePlayGameSettings.txt
index 2e8de03..3389fc9 100644
--- a/ProjectSettings/GooglePlayGameSettings.txt
+++ b/ProjectSettings/GooglePlayGameSettings.txt
@@ -1,9 +1,2 @@
lastUpgrade=01101
proj.pluginVersion=0.11.01
-proj.AppId=1045293753265
-and.BundleId=com.stash.iosdemo
-proj.classDir=Assets%2fSamples
-proj.ConstantsClassName=GPGSIds
-and.ResourceData=%3c%3fxml+version%3d%221.0%22+encoding%3d%22utf-8%22%3f%3e%0a%3c%21--Google+Play+game+services+IDs.+Save+this+file+as+res%2fvalues%2fgames-ids.xml+in+your+project.--%3e%0a%3cresources%3e%0a++%3c%21--app_id--%3e%0a++%3cstring+name%3d%22app_id%22+translatable%3d%22false%22%3e1045293753265%3c%2fstring%3e%0a++%3c%21--package_name--%3e%0a++%3cstring+name%3d%22package_name%22+translatable%3d%22false%22%3ecom.stash.iosdemo%3c%2fstring%3e%0a++%3c%21--achievement+Test+Achievement--%3e%0a++%3cstring+name%3d%22achievement_test_achievement%22+translatable%3d%22false%22%3eCgkIscfzgrYeEAIQAw%3c%2fstring%3e%0a%3c%2fresources%3e
-and.ClientId=1045293753265-ejh4ifdimiqfqhj2msj2c3h7oib9r7aq.apps.googleusercontent.com
-android.SetupDone=true
diff --git a/ProjectSettings/GvhProjectSettings.xml b/ProjectSettings/GvhProjectSettings.xml
index 42602f6..1d4f738 100644
--- a/ProjectSettings/GvhProjectSettings.xml
+++ b/ProjectSettings/GvhProjectSettings.xml
@@ -2,7 +2,8 @@
-
+
+
\ No newline at end of file