torusresearch / torus-embed

Embeds the Torus Wallet directly in your application via torus-embed. Exposes a Web3 Provider.
https://demo-eth.tor.us
MIT License
84 stars 52 forks source link

Connect with email on iPhone not working #399

Closed petecgny closed 2 years ago

petecgny commented 2 years ago

Describe the bug When I run my dAPP on my iPhone running IOS 15.1 in Safari and try to connect to my Torus Wallet using email, not social sign-in, it does not connect when I return to my app after clicking the verification email. It works on mobile with social sign-in and it works on my laptop with email.

To Reproduce Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior Expect to connect when I return to my Dapp in the browser.

Screenshots If applicable, add screenshots to help explain your problem.

If it would help let me know and I can record a video of my iPhone screen as I go through the steps to connect, verify my email, and go back to my dApp.

Smartphone (please complete the following information):

Additional context Add any other context about the problem here.

BboyStatix commented 2 years ago

Hey there @petecgny are you accessing your email via another app, or within the safari browser itself?

petecgny commented 2 years ago

Hi @BboyStatix I access my email from the native email app on my iPhone. When I click 'confirm my email' it opens up a tab in my safari browser that says Done. Close this and return to your previous window. When I do and go back to the safari tab my dApp is running in I am not connected.

BboyStatix commented 2 years ago

Hi @petecgny we are currently working on resolving this issue. I've reproduced it internally and it seems to be related to IOS 15 Safari having the experimental "NSURLSession WebSocket" open by default. Turning that off seems to fix the issue (can be found in Settings > Safari > Advanced > Experimental Features). Of course this is only a temporary workaround. Relevant link: https://developer.apple.com/forums/thread/685403

When clicking the magic link from outside Safari (e.g. Mail app), it seems to cause the WebSocket connection to terminate and initiates a new one. On the other hand if it were clicked from within Safari (e.g. another tab logged into your mailbox) the issue doesn't occur.

We'll continue working on a fix. For the time being you can use the above workarounds.

petecgny commented 2 years ago

Thank you, Naveed. Glad you were able to reproduce it and isolate what is causing the problem.

On Wed, Dec 29, 2021 at 4:05 AM Naveed Elahi @.***> wrote:

Hi @petecgny https://github.com/petecgny we are currently working on resolving this issue. I've reproduced it internally and it seems to be related to IOS 15 Safari having the experimental "NSURLSession WebSocket" open by default. Turning that off seems to fix the issue (can be found in Settings > Safari > Advanced > Experimental Features). Of course this is only a temporary workaround. Relevant link: https://developer.apple.com/forums/thread/685403

When clicking the magic link from outside Safari (e.g. Mail app), it seems to cause the WebSocket connection to terminate and initiates a new one. On the other hand if it were clicked from within Safari (e.g. another tab logged into your mailbox) the issue doesn't occur.

We'll continue working on a fix. For the time being you can use the above workarounds.

— Reply to this email directly, view it on GitHub https://github.com/torusresearch/torus-embed/issues/399#issuecomment-1002471330, or unsubscribe https://github.com/notifications/unsubscribe-auth/AWS3QLCBGBV6BYOW5DR4KO3UTLFOTANCNFSM5KRC4GFA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you were mentioned.Message ID: @.***>

petecgny commented 2 years ago

Hi @chaitanyapotti, I see you marked this issue as closed. @BboyStatix was able to reproduce and isolate the issue but did not come up with a fix yet. Asking our customers to change their settings in order to connect their Torus wallet using email on an iPhone is not a good user experience or something we expect they will do.

Are you working on a fix beyond this temporary solution and when do you expect to have it resolved?

petecgny commented 2 years ago

@BboyStatix following up to see if you have a fix for this

BboyStatix commented 2 years ago

@petecgny we are currently testing out a fix https://github.com/torusresearch/torus-passwordless-auth-frontend/pull/39

BboyStatix commented 2 years ago

@petecgny can you try it out now?

petecgny commented 2 years ago

@BboyStatix Awesome. It worked. Thank you. What was the fix and how hard was it to figure out?

BboyStatix commented 2 years ago

@petecgny great to hear that. This was the PR that fixed it https://github.com/torusresearch/torus-passwordless-auth-frontend/pull/41 Basically, upon socket reconnection, we re-request the server to emit the event the logs the user in. This solves the problem of us missing the emitted server event when the user minimises app (due to the websocket connection being closed).