'Access-Control-Allow-Credentials' header in the response is '' which must be 'true' 'Access-Control-Allow-Credentials' header in the response is '' which must be 'true' angular angular

'Access-Control-Allow-Credentials' header in the response is '' which must be 'true'


While setting cors in corsOptions I added value credentials true it worked as follows:

private setCors(){        let whitelist = ['http://localhost:4200','http://localhost:80'];        let corsOptions = {            origin: (origin:any, callback:any)=>{                if (whitelist.indexOf(origin) !== -1) {                    callback(null, true)                } else {                    callback(new Error('Not allowed by CORS'))                }            },credentials: true        }        this.app.use(cors(corsOptions));    }