问题
I'm working on a project where I want to get my calendar events through google API, written in JS and using React.
My question is why do I receive this error? I do receive my calendar events but beforehand this error pops up in the console of the web browser and I've tried it in firefox & chrome.
Chrome err: https://gyazo.com/bf7687b094c24d0027bcbd4071783b8c
Firefox err: https://gyazo.com/fa605bc75833d71070acbac34f1275da
This is how my app.js looks like: https://gyazo.com/f09b6906234c7d65b30ba4f40def1e50
回答1:
Some servers require auth key in the preflight OPTIONS request. Add the following line below your cors attachment:
app.use(cors());
app.options('*', cors());
回答2:
Check this Link It requires auth token in header to validate the request.
Also check this Post, its where i found above link.
来源:https://stackoverflow.com/questions/51836261/cross-origin-request-blocked-origin-null-no-access