Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug][IOS] A message is shown before Twake app is open from success page #3446

Open
thuyenh1081 opened this issue Jan 24, 2025 · 2 comments
Open
Assignees
Labels
bug Something isn't working

Comments

@thuyenh1081
Copy link

thuyenh1081 commented Jan 24, 2025

Device: iphone11
Twake app: vesion 0.14.2, browser: safari
environment: stg.lin-saas.com

Precondition: Twake app is installed
Steps:

  1. Open safari browser, go to url: http://sign-up.stg.lin-saas.com/
  2. Make a success sign-in/ sign-up
  3. On the success page, I direct to the Twake mail

Actual: after step3, I see the message "Safari can not open the page because the address is invalid" before the Twake app is opened
Expect: after step3, the message is not shown

OpenMailFromSuccessPage.mp4

@tprudentova @hoangdat

@thuyenh1081 thuyenh1081 added the bug Something isn't working label Jan 24, 2025
@chibenwa
Copy link
Member

chibenwa commented Jan 24, 2025

Please split "actual behaviour" and "expected behaviour". Follow the official template please.

As it stands I fail at understanding what's expected in this bug report.

@dab246 dab246 self-assigned this Feb 10, 2025
@dab246
Copy link
Member

dab246 commented Feb 10, 2025

Possible Causes:

  • After opening app, Safari doesn't receive a proper response from the OAuth webpage.
  • The OAuth page remains open in the background and does not close itself.
  • Safari expects a valid web URL after redirection, but instead, it tries to open a deep link (twakemail.mobile://), which is not a standard web page.

Solution

  1. Automatically close the OAuth webpage after redirection

Add this JavaScript snippet to your OAuth webpage (the page that redirects to your app):

<script>
  setTimeout(function() {
    window.close(); // Close the page after 500ms
  }, 500);
</script>

=> The OAuth webpage will automatically close after it opens app. Safari will no longer display an invalid address error.

  1. Redirect to a "Success" page before closing

Instead of directly opening the deep link (twakemail.mobile://openapp?...), redirect the user to an intermediate success page before closing:

<p>Login successful! You can close this page.</p>
<script>
  setTimeout(function() {
    window.location.href = "twakemail.mobile://openapp?access_token=your_token";
    setTimeout(() => window.close(), 1000); // Close after opening the app
  }, 500);
</script>

=> Gives Safari a valid web page to load before switching to app. Avoids the "invalid address" error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants