I am in the middle of building my very first Shopify App. During installation I used the Shopify CLI to get started quickly and easily. I am using React + NodeJS + Mongo.
Due to the fact that Safari is blocking all 3rd party cookies I am not able to get my app running on Safari.
My research revealed that devs are now āforcedā to use session tokens to authenticate instead of cookies. Is that there any easier way?
If not: Although Iāve seen this tutorial I am kinda stuck of where to start since the guide doesnāt provide clear coding details.
Let me say first off that I donāt know what the Node app that the Shopify CLI creates is doing under the hood (so this may not be helpful), but in my case Iām just using standard JS on the front end and Node on the server side. Iāve been messing around with this in my dev environment and it was pretty straightforward to implement using the āUse session token helpers directlyā section of the tutorial. You use App Bridge Utils to get the jwt, and then someone published an npm library to validate it on your server side: https://www.npmjs.com/package/shopify-jwt-auth-verify. But again, Iām not sure how easy it is to modify or substitute whatever the existing Shopify CLI Node app is doing.
Browsers are slowly putting more and more restrictions on the use of cookies in iframes. As a result, weāve built the new session token auth method to allow embedded apps to authenticate without persisting cookies. At this point, if you want your embedded app to work in Safari, you need to use session token auth. This will eventually become true for Firefox and Chrome as well. Weāre adapting to this situation too, and actively working on improving the tooling.
For example: weāre in the process of updating the starter embedded app you get from Shopify CLI to use the new session token authentication. Long story short, getting session tokens to work with server-side rendering is not trivial. In the meantime, check out this thread on the App Bridge issues board: https://github.com/Shopify/shopify-app-bridge/issues/13. Thereās a working example there using Next.js that might help you out.
If you havenāt already checked out the Shopify Partners Slack workspace, Iād encourage you to join there as well. You can find the link in the Support section in Shopify Partners. Shopify staff are active there as well, and it can be quicker to work through issues there.
I am going to check the Slack space and the board you mentioned. Can you give me some realistic dates on when the Shopify CLI will be able to provide the updated starter version? Perhaps itās a good idea to wait if itās only 1-2 weeks.
Hi @iain-campbell ! We have implemented the new cookieless authentication to our embedded app as you mentioned previously, but it still doesnāt work properly in Safari when our customer checked their setting āprevent cross-site trackingā. The app will stop with no popup hints and will display the following errors in browser console: