Skip to content Skip to sidebar Skip to footer

Cors 'allow-credentials' Nodejs/express

My project is running on Node with an Express backend. I'm trying to query my Arango database clientside with Arangojs. ArangoDB is running on Docker on Digital Ocean. I have no is

Solution 1:

You are configuring cors() wrong, you have to use credentials property in order to configure Access-Control-Allow-Credentials:

var cors = require('cors');
var corsOptions = {
    origin: '*',
    credentials: true };

app.use(cors(corsOptions));

Besides that, your app.all(* ... isnt necessary because app.use(cors(corsOptions)); will already handle it for you.

Solution 2:

You must set origin with a "trusted" URL or an array of "trusted" URLs, each with protocol + domain + port when, you configure cors with credentials. origin : '*' is blocked, because using credentials for every origin is too permissive. It is like not using credentials at all.

Post a Comment for "Cors 'allow-credentials' Nodejs/express"