I've tried everything to get around the CORS error I am receiving. For oauth flow, to redirect your app to the Salesforce login screen (but this url auto redirects behind the scenes from salesforce to salesforce)
XMLHttpRequest cannot load salesforce url 2 Redirect from salesforce url 1 to salesforce oauth url 2 has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:3000' is therefore not allowed access.
I've installed CORS module and also tried this:
app.use('/public',function(req, res, next) {
res.setHeader("Access-Control-Allow-Origin", "*");
// Request headers you wish to allow
res.setHeader("Access-Control-Allow-Headers", "Origin, X-Requested-
With, Content-Type, Accept");
// Set to true if you need the website to include cookies in the
requests sent
res.setHeader('Access-Control-Allow-Credentials', true);
// Pass to next layer of middleware
next();
});
Can anyone actually get this working and help?