Hi :)
I am building browser extension that is integral part of our bigger web service. Since it needs to authenticate with our web application to use its api. Extension was originally developed for the Chrome and there everything works perfectly fine without any additional work. When I am authenticated on the platform I am able to use extension on any website and while making api calls from extensions background script to the platform backend the cookie is automatically attached to it. I just do fetch without any headers etc everything works out of the box.
Then I used the xcrun safari-web-extension-converter
and converted the chrome extension to safari. I tested local build as well as build submitted to test flight and none of these seems to work the same way as on chrome. Meaning I am not able to make this safari extension pick up the cookie from my web application.
I found that if I disable: prevent cross-site tracking
in Safari Settings it works. But obviously its not a solution for the normal users.
Can anyone help me to make it work? I am not very familiar with apple dev environment.
Ok I managed to solve the problem :OO Leaving the answer to someone that may have same problem in the future :D
In my manifest file I had to change background.service_worker to background.scripts.
Apparently service_worker runs on the separate thread and has limited browser context hence no access to the cookies
If you use background.scripts instead it will make extension generate persistent background page that has a possibility to pickup the cookies :D Everything works out of the box now :D