Skip to content

Commit 861c632

Browse files
committed
feat: auth-services v9 updates and session manager updates
Signed-off-by: Gaurav Goel <[email protected]>
1 parent 4dca667 commit 861c632

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

Assets/Plugins/Web3AuthSDK/Samples/Web3AuthSample.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ void Start()
9696
*/
9797
clientId = "BFuUqebV5I8Pz5F7a5A2ihW7YVmbv_OHXnHYDv6OltAD5NGr6e-ViNvde3U4BHdn6HvwfkgobhVu4VwC-OSJkik",
9898
buildEnv = BuildEnv.TESTING,
99-
redirectUrl = new Uri("torusapp://com.torus.Web3AuthUnity/auth"),
99+
redirectUrl = new Uri("torusapp://com.torus.Web3AuthUnity"),
100100
network = Web3Auth.Network.SAPPHIRE_DEVNET,
101101
sessionTime = 86400
102102
});

Assets/Plugins/Web3AuthSDK/Web3Auth.cs

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,10 @@ private void IncomingHttpRequest(IAsyncResult result)
267267
private async void processRequest(string path, LoginParams loginParams = null)
268268
{
269269
redirectUrl = this.initParams["redirectUrl"].ToString();
270+
if (redirectUrl.EndsWith("/"))
271+
{
272+
redirectUrl = redirectUrl.TrimEnd('/');
273+
}
270274

271275
#if UNITY_STANDALONE || UNITY_EDITOR
272276
this.initParams["redirectUrl"] = StartLocalWebserver();
@@ -276,6 +280,7 @@ private async void processRequest(string path, LoginParams loginParams = null)
276280
#endif
277281

278282
loginParams.redirectUrl = loginParams.redirectUrl ?? new Uri(this.initParams["redirectUrl"].ToString());
283+
//Debug.Log("loginParams.redirectUrl: =>" + loginParams.redirectUrl);
279284
Dictionary<string, object> paramMap = new Dictionary<string, object>();
280285
paramMap["options"] = this.initParams;
281286
paramMap["params"] = loginParams == null ? (object)new Dictionary<string, object>() : (object)loginParams;
@@ -332,6 +337,10 @@ public async void launchWalletServices(ChainConfig chainConfig, string path = "w
332337
if (!string.IsNullOrEmpty(sessionId))
333338
{
334339
redirectUrl = this.initParams["redirectUrl"].ToString();
340+
if (redirectUrl.EndsWith("/"))
341+
{
342+
redirectUrl = redirectUrl.TrimEnd('/');
343+
}
335344
#if UNITY_STANDALONE || UNITY_EDITOR
336345
this.initParams["redirectUrl"] = StartLocalWebserver();
337346
redirectUrl = this.initParams["redirectUrl"].ToString().Replace("/complete/", "");
@@ -435,7 +444,6 @@ public void setResultUrl(Uri uri)
435444
this.Enqueue(() => KeyStoreManagerUtils.savePreferenceData(KeyStoreManagerUtils.REDIRECT_URL, redirectUrl));
436445

437446
//call authorize session API
438-
//Debug.Log("redirectUrl: =>" + redirectUrl);
439447
this.Enqueue(() => authorizeSession(sessionId, redirectUrl));
440448

441449
#if !UNITY_EDITOR && UNITY_WEBGL
@@ -546,6 +554,10 @@ public async void request(ChainConfig chainConfig, string method, JArray request
546554
if (!string.IsNullOrEmpty(sessionId))
547555
{
548556
redirectUrl = this.initParams["redirectUrl"].ToString();
557+
if (redirectUrl.EndsWith("/"))
558+
{
559+
redirectUrl = redirectUrl.TrimEnd('/');
560+
}
549561
#if UNITY_STANDALONE || UNITY_EDITOR
550562
this.initParams["redirectUrl"] = StartLocalWebserver();
551563
redirectUrl = this.initParams["redirectUrl"].ToString().Replace("/complete/", "");
@@ -625,7 +637,6 @@ private void authorizeSession(string newSessionId, string origin)
625637
if (!string.IsNullOrEmpty(sessionId))
626638
{
627639
var pubKey = KeyStoreManagerUtils.getPubKey(sessionId);
628-
//Debug.Log("pubKey: =>" + pubKey);
629640
//Debug.Log("origin: =>" + origin);
630641
StartCoroutine(Web3AuthApi.getInstance().authorizeSession(pubKey, origin, (response =>
631642
{

0 commit comments

Comments
 (0)