@@ -108,7 +108,7 @@ public async void setOptions(Web3AuthOptions web3AuthOptions)
108108 {
109109 throw new Exception ( "Failed to fetch project config. Please try again later." ) ;
110110 } else {
111- authorizeSession ( "" ) ;
111+ authorizeSession ( "" , this . web3AuthOptions . redirectUrl . ToString ( ) ) ;
112112
113113 JsonSerializerSettings settings = new JsonSerializerSettings
114114 {
@@ -287,7 +287,7 @@ private async void processRequest(string path, LoginParams loginParams = null)
287287 new JsonSerializerSettings
288288 {
289289 NullValueHandling = NullValueHandling . Ignore
290- } ) , 600 ) ;
290+ } ) , 600 , "*" ) ;
291291
292292 if ( ! string . IsNullOrEmpty ( loginId ) )
293293 {
@@ -341,7 +341,7 @@ public async void launchWalletServices(ChainConfig chainConfig, string path = "w
341341 new JsonSerializerSettings
342342 {
343343 NullValueHandling = NullValueHandling . Ignore
344- } ) , 600 ) ;
344+ } ) , 600 , "*" ) ;
345345
346346 if ( ! string . IsNullOrEmpty ( loginId ) )
347347 {
@@ -427,7 +427,7 @@ public void setResultUrl(Uri uri)
427427 this . Enqueue ( ( ) => KeyStoreManagerUtils . savePreferenceData ( KeyStoreManagerUtils . SESSION_ID , sessionId ) ) ;
428428
429429 //call authorize session API
430- this . Enqueue ( ( ) => authorizeSession ( sessionId ) ) ;
430+ this . Enqueue ( ( ) => authorizeSession ( sessionId , this . web3AuthOptions . redirectUrl . ToString ( ) ) ) ;
431431
432432#if ! UNITY_EDITOR && UNITY_WEBGL
433433 if ( this . web3AuthResponse != null )
@@ -550,7 +550,7 @@ public async void request(ChainConfig chainConfig, string method, JArray request
550550 new JsonSerializerSettings
551551 {
552552 NullValueHandling = NullValueHandling . Ignore
553- } ) , 60000 ) ;
553+ } ) , 600 , "*" ) ;
554554
555555 if ( ! string . IsNullOrEmpty ( loginId ) )
556556 {
@@ -598,7 +598,7 @@ public async void request(ChainConfig chainConfig, string method, JArray request
598598 }
599599 }
600600
601- private void authorizeSession ( string newSessionId )
601+ private void authorizeSession ( string newSessionId , string origin )
602602 {
603603 string sessionId = "" ;
604604 if ( string . IsNullOrEmpty ( newSessionId ) )
@@ -614,7 +614,9 @@ private void authorizeSession(string newSessionId)
614614 if ( ! string . IsNullOrEmpty ( sessionId ) )
615615 {
616616 var pubKey = KeyStoreManagerUtils . getPubKey ( sessionId ) ;
617- StartCoroutine ( Web3AuthApi . getInstance ( ) . authorizeSession ( pubKey , ( response =>
617+ Debug . Log ( "pubKey: =>" + pubKey ) ;
618+ Debug . Log ( "origin: =>" + origin ) ;
619+ StartCoroutine ( Web3AuthApi . getInstance ( ) . authorizeSession ( pubKey , origin , ( response =>
618620 {
619621 if ( response != null )
620622 {
@@ -668,7 +670,7 @@ private void sessionTimeOutAPI()
668670 if ( ! string . IsNullOrEmpty ( sessionId ) )
669671 {
670672 var pubKey = KeyStoreManagerUtils . getPubKey ( sessionId ) ;
671- StartCoroutine ( Web3AuthApi . getInstance ( ) . authorizeSession ( pubKey , ( response =>
673+ StartCoroutine ( Web3AuthApi . getInstance ( ) . authorizeSession ( pubKey , this . web3AuthOptions . redirectUrl . ToString ( ) , ( response =>
672674 {
673675 if ( response != null )
674676 {
@@ -724,7 +726,7 @@ private void sessionTimeOutAPI()
724726 }
725727 }
726728
727- private async Task < string > createSession ( string data , long sessionTime )
729+ private async Task < string > createSession ( string data , long sessionTime , string allowedOrigin )
728730 {
729731 TaskCompletionSource < string > createSessionResponse = new TaskCompletionSource < string > ( ) ;
730732 var newSessionKey = KeyStoreManagerUtils . generateRandomSessionKey ( ) ;
@@ -756,7 +758,8 @@ private async Task<string> createSession(string data, long sessionTime)
756758 newSessionKey ,
757759 jsonData
758760 ) ,
759- timeout = Math . Min ( sessionTime , 7 * 86400 )
761+ timeout = Math . Min ( sessionTime , 7 * 86400 ) ,
762+ allowedOrigin = allowedOrigin
760763 } , result =>
761764 {
762765 if ( result != null )
0 commit comments