Web3Auth / mpc-core-kit

15 stars 4 forks source link

[v3]loginWithOauth issue on Safari when using popup as uxMode #154

Closed AyushBherwani1998 closed 1 week ago

AyushBherwani1998 commented 1 month ago

Description

Not able to login in Safari browser when using loginWithOauth with popup as uxMode. It initiates the login, and after login, it's not able to redirect properly. On the other hand, same works fine on the Chrome browser.

Screen-recording

https://github.com/Web3Auth/mpc-core-kit/assets/34301187/855cf289-5321-4d9b-a292-ba90f0c7d460

AyushBherwani1998 commented 1 month ago

The error in the console of popup:

WebSocket connection to 'wss://broadcast-server.tor.us/socket.io/?EIO=4&transport=websocket' failed: WebSocket is closed due to suspension.
matthiasgeihs commented 1 week ago

Seems to be related to an issue with the service worker in CustomAuth.

metalurgical commented 1 week ago

If no problem can be found anywhere else this might be related to a bug resurfacing in safari.

Are you running the latest version, or perhaps an older versions?

It has been patched at least twice before for webkit: https://bugs.webkit.org/show_bug.cgi?id=143513 https://bugs.webkit.org/show_bug.cgi?id=228329

matthiasgeihs commented 1 week ago

Update: The issue is not in mpc-core-kit, neither in CustomAuth. The issue was that in order to use the popup flow, additional service worker worker code (sw.js) needs to be served with the app. However, this code was not updated in the example. Fixed in https://github.com/Web3Auth/web3auth-core-kit-examples/pull/607.

metalurgical commented 1 week ago

Nice find!

matthiasgeihs commented 1 week ago

Credits go to @ieow ;)