Login identity not working on iOS and Safari

After much testing, I cannot get the login identity to work on IOS or Safari on Mac. just not returning the identity or passing it to the query. works fine on chrome, android, and Firefox. screenshots of safari and chrome.

Can you check the cookies tab?

In Safari the cookies and local storage are blank. Session storage shows the identity correctly and another variable I used for testing.

I was talking about that cookie tab (between “headers” and “sizes”)

sorry.

Request Cookies
No request cookies.

Response Cookies
No response cookies.

First of all, the login works fine? I mean, you login and you can see restricted data? What happens if you reload the page?

Yes the login works. don’t get an unauthorized. if I reload same thing. if I do a workaround and add a session variable. On the login page if I do not redirect and just see if it is getting the identity with an alert it shows on all devices.

Again this is just on safari and iOS.

So the problem is when you go to another page after the login screen?
And you can see restricted data after the redirect?

Correct. Cannot see the restricted data on iOS or desktop safari. can see the restricted data on everything else.

Well seems a cookie issue to me. Of course I can be wrong, but I remember having some issues with that.

Check this (compare it to chrome/android)
When you login, check the cookies tab of the login api (the one you use on the form).
You’ll see a response there.

doesn’t show there either. This is very strange as it passes the data.

What do you mean with “it passes the data?”
What I think it’s happening here is that the login steps works but the login info is not being saved.
Maybe that’s why you dont see the identity or the restricted data. As far as I know, Ios/android chrome/safari handles on differents way how cookies are being saved.

Do you have the cookies plugin on your capacitor project? You can see it on the config json.

sorry not sure how to do that. In capacitor.config.json?

By Passing the data I meant it returns the current user protected data.

also is I store a session variable that is set to the login identity, I can do a workaround for the query for current user, but I cannot seem to protect the pages.

Do you have the credentials option ticked in the Server Connect item on the page where the user is logged in?

Ues credentials is ticked. The countries listed in the screwnshot are unprotected but the identity and first name are protected

The dependencies on package.json
Try to add the cookies plugin to the capacitor project and run npx cap synx

  1. What if you restrict the country list?
    Again, seems to me that the login works but the cookies are not being saved on safari/ios, so when you go to a page with restricted data or a query with the user detail, nothing is there.

We were working with Steven and found out that cookies are being saved on an Android/Web project.

On ios after login (200) we reload the page and we get a 401.

It’s something to do with allowing third party cookies.
When we disable this:


Everything works as expected.

How can we configure the project to allow cookies?
There’s must be something we can do.

Any advice will be appreciated.

Have you read the Cookies documentation with regards to IOS @franse

I’m not sure but you may have to add the domain to a ‘white list’ for IOS purposes?

Third Party Cookies on iOS

As of iOS 14, you cannot use 3rd party cookies by default. Add the following lines to your Info.plist file to get better support for cookies on iOS. You can add up to 10 domains.

<key>WKAppBoundDomains</key>
<array>
  <string>www.mydomain.com</string>
  <string>api.mydomain.com</string>
  <string>www.myothercooldomain.com</string>
</array>

Yes, have been added to the info.plist :pensive:

Did you see this running post on the GitHub repo? Might offer some inkling on the situation, and a fix…?