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

Login not working on Safari / iOS (solved) #4

Closed
monsieurnebo opened this issue Sep 4, 2023 · 2 comments
Closed

Login not working on Safari / iOS (solved) #4

monsieurnebo opened this issue Sep 4, 2023 · 2 comments

Comments

@monsieurnebo
Copy link
Contributor

monsieurnebo commented Sep 4, 2023

Hello,

The app login is not working on desktop Safari and iOS devices.

The issue

The first query (logIn) is sending the email / password as expected, but is not setting the auth cookie as it should do:

{
    "operationName": "logIn",
    "variables": {
        "login": "email@address.com",
        "password": "password"
    },
    "query": "mutation logIn($login: String!, $password: String!) {\n  loginWithCookies(input: {login: $login, password: $password}) {\n    status\n    __typename\n  }\n}\n"
}

As a consequence, the second query (getUser) is returning the following response:

    "data": {
        "viewer": null
    },

The solution

This is because Apple doesn't allow cross-site cookies (related StackOverFlow thread)

The short-term solution is to disable this option from Safari settings:

Safari > Settings > Site tracking > Prevent Cross-Site Tracking.

It will allow you to use the app, but it won't fix the issue for all other Safari / iOS users...

The long-term solution is to host both the WordPress (back-end) & the webapp (front-end) on the same domain (e.g. each one on a different sub-domain).


Related to:
#1
#2
#3

CC @kellenmace

@monsieurnebo monsieurnebo changed the title Cookies cannot be set on desktop Safari / iOS: the solution Login not working on Safari / iOS: the solution Sep 4, 2023
@monsieurnebo monsieurnebo changed the title Login not working on Safari / iOS: the solution Login not working on Safari / iOS (solved) Sep 4, 2023
@monsieurnebo
Copy link
Contributor Author

@kellenmace I created a PR to add a warning about this in the Readme.

@kellenmace
Copy link
Owner

Thanks for the info, Cyril. I have merged in the PR to let other developers know about the shortcoming of this approach in Safari.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants