We are not able to set-cookie

We are using Ionic capacitor framework and the problem. we can’t seem to access or see the set-cookie of the header. But i can see it in the Browsers Network Tab. We have also added and http Interceptor with the following code
request = request.clone({
withCredentials: true
});
Still we are having issues. Any help would be great!

What are you trying to use cookies for? From my knowledge, it isn’t really recommended to rely on cookies in a Ionic/Capacitor app.

We have a 3rd party integration for authentication and that requires to respect the cookies that is to be sent by the application .

Thank you for reply.

I am with the same problem now, I need to access the cookies to be able to login against my server.
What is recommended to do?

I think you might now be able to use the Capacitor Cookie plugin. My guess is that you would also need to use the HTTP plugin as well which intercepts JS calls and sends them through native HTTP requests.

The release notes of Capacitor 4.6.0 say:

  • cookies: Use Set-Cookie headers to persist cookies (57f8b39)

so assuming sending a Set-Cookie from your server, Capacitor will set the cookie in native land.

2 Likes