diff --git a/Assets/Plugins/Web3AuthSDK/Web3Auth.cs b/Assets/Plugins/Web3AuthSDK/Web3Auth.cs index 6fa8716..18b1675 100644 --- a/Assets/Plugins/Web3AuthSDK/Web3Auth.cs +++ b/Assets/Plugins/Web3AuthSDK/Web3Auth.cs @@ -374,12 +374,14 @@ public void setResultUrl(Uri uri) throw new UserCancelledException(); #endif hash = hash.Remove(0, 1); - Dictionary queryParameters = Utils.ParseQuery(uri.Query); + Dictionary queryParameters = Utils.ParseQuery(uri.Query); if (queryParameters.Keys.Contains("error")) throw new UnKnownException(queryParameters["error"]); - string b64Params = hash.Split('=')[1]; + string newUriString = "http://" + uri.Host + "?" + hash; + Uri newUri = new Uri(newUriString); + string b64Params = getQueryParamValue(newUri, "b64Params"); string decodedString = decodeBase64Params(b64Params); SessionResponse sessionResponse = null; try @@ -404,6 +406,25 @@ public void setResultUrl(Uri uri) #endif } + private string getQueryParamValue(Uri uri, string key) + { + string value = ""; + if (uri.Query != null && uri.Query.Length > 0) + { + string[] queryParameters = uri.Query.Substring(1).Split('&'); + foreach (string queryParameter in queryParameters) + { + string[] keyValue = queryParameter.Split('='); + if (keyValue[0] == key) + { + value = keyValue[1]; + break; + } + } + } + return value; + } + private string decodeBase64Params(string base64Params) { if(string.IsNullOrEmpty(base64Params))