Proxy
Salesforce won’t let you lauch request from the same app browser.
To be able to lauch request without cors errors add this in nuxtconfig.js
http: {
proxies: {
'/proxy-path': {
target: 'target-url',
changeOrigin: true,
secure: false,
pathRewrite: { '^/proxy-path': '' },
},
},
Localhost
Salesforce don’t allow request from localhost.
Now you’ll need to use a reverse proxy
- Install ngrok follow the setup
- Run your project on localhost
- In shell type ngrok http ‘your_localhost_port’. Note the Forwarding url (https://H-A-S-H.eu.ngrok.io)
- In salesforce : Setup → Security → Remote Site Settings. Add an new remote site
- You can now use your app on the forwarding url (https://H-A-S-H.eu.ngrok.io), send request, and see your changes without having to deploy on an other instance.
Security/cors
Allowed Origins List
add the domain, for example https://sandbox.iomedia.ch
.
Cross-Origin Resource Sharing (CORS) Policy Settings
- Enable CORS for OAuth endpoints
Manage Connected Apps
API (Enable OAuth Settings)