torusresearch/torus-embed

Connect with email on iPhone not working

petecgny opened this issue · 10 comments

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):

  • Device: iPhone10XR
  • OS: iOS 15.1]
  • Browser Safari
  • Version [e.g. 22]

Additional context
Add any other context about the problem here.

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

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.

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.

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?

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

@petecgny can you try it out now?

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

@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).