Mobile - Logout does not work after facebook login

Hey guys , I am facing an issue, After Facebook login when i click the logout button, the page gets stuck. There is no redirection to index page . However if i reload the page it is redirected to the index page indicating that the session is destroyed. Now this shows that there is some error while redirecting after logout button is clicked. Can anyone help me finding the solution for this issue.

This happens in mobile device , in web it is working fine.

Thank you.

1 Like

Can you repro it here on Meta?

I am able to reproduce issue in https://try.discourse.org/.

Attached video

1 Like

Can you repro this @tshenry?

2 Likes

Yessir. I can repro on iOS Safari.

3 Likes

What’s the actual error @tshenry?

The logout is successful, it’s just not refreshing/redirecting successfully.

There’s no error popup, nor anything in the /logs that I can see (even with verbose logging). There’s nothing in the browser console from the initial logout attempt, but errors start after subsequent logout attempts (trying to logout when I’m technically already logged out):

3 Likes

This is very similar to a recent bug I reported to Apple.

Can you try to repro after setting same site cookies to Disabled on Try? You will need to logoff/login again after changing the setting for is to take effect.

5 Likes

Yes, the issue still persists even after setting “same site cookies” to disabled.

2 Likes

Can you confirm this is also reproducible on meta? Also confirm this is only on mobile? Does this also happen if you add ?mobile_view=1 to the url to force mobile view on desktop?

3 Likes

I have not checked in meta, only checked in https://try.discourse.org/. Yes it happens only in mobile IOS safari and no it does not happen when i add ?mobile_view=1 to the url to force mobile view on desktop. @tshenry please confirm my observations.

1 Like

I can confirm:

  • The log out redirect works fine on Desktop Safari when mobile view has been forced
  • The issue is reproducible on Meta with mobile Safari
  • It looks like it’s only an issue when attempting to log out from the initial landing page after each time I log in.
    • if I log in, enter a topic and try to log out, the logout redirect works fine.
    • if I log in, enter a topic, hit the back button, then try to sign out, the logout redirect does NOT work
    • If I log in, enter a topic, hit the home logo, then try to sign out, the logout redirect works

@Falco, you were right! I just tried this on Try and it does fix this issue.

4 Likes

Oh man I should have bet on that :facepalm:

I had to disable Discourse offline because of this bug, even though the feature works fine but we default to strict cookies who triggers bugs on Safari.

3 Likes

@tshenry, i am still facing the issue after setting “same site cookies” to disabled. However, the redirect worked fine after trying for the first time. But when i tried again it did not worked.

Also i checked in try also, it didn’t worked the second time.

1 Like

Hmm, you’re right… I think I got excited after seeing it work the first time and failed to try subsequent times :pensive:

I do have a new note to add - the logout redirect seems to work directly after receiving an “Authorization timed out, or you have switched browsers. Please try again,” message. It seems to happen when trying to log in very quickly after logging out.

The clip below shows a failed logout redirect at first, then at 13 seconds, it shows the redirect working after the message was displayed.

2 Likes