-
I added the code for fetching data from pantry but I found that I kept getting CORS errors: I can try to disable this manually but I'm wondering if there's a better way? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
CORS is a feature of browsers and part of internet security. You can't disable it. The opaque response mentioned in the error response is probably not the solution you are looking for. Short answer, you can't access pantry directly from javascript running in the browser. You need to provide your own middle tier to handle requests. Even if you could, Pantry works with a secret key (the pantry id) that you don't want to give away. Putting that key in your javascript code is giving it away to your users. They would then have access to do anything they want with your data. Hope this helps. |
Beta Was this translation helpful? Give feedback.
-
Hi, I am developing a personal plugin, is it possible to allow the use of CORS when the request is originated from At this level when the secret key is stored in local storage it cannot be seen. |
Beta Was this translation helpful? Give feedback.
CORS is a feature of browsers and part of internet security. You can't disable it. The opaque response mentioned in the error response is probably not the solution you are looking for.
Short answer, you can't access pantry directly from javascript running in the browser. You need to provide your own middle tier to handle requests.
Even if you could, Pantry works with a secret key (the pantry id) that you don't want to give away. Putting that key in your javascript code is giving it away to your users. They would then have access to do anything they want with your data.
Hope this helps.