user9056339
user9056339

Reputation:

Cross-origin request blocked, origin 'null' no access

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

Upvotes: 1

Views: 1551

Answers (1)

justMe
justMe

Reputation: 664

Some servers require auth key in the preflight OPTIONS request. Add the following line below your cors attachment:

app.use(cors());
app.options('*', cors());

Upvotes: 0

Related Questions