AXIOS withCredentials在server.js中不起作用

时间:2020-07-09 01:11:44

标签: spring-boot express axios csrf

我有server.js作为代理来调用Spring boot -Java。当我尝试在server.js中将withcred设置为true时,没有得到CSRF cookie,但是当我直接从React js进行调用时,它的工作正常。

    app.get('/test', function(req, res) {
const transport = axios.create({
    withCredentials: true
  })
var https = require('https');
  axios
    .get(
      url+'/token',{
      },
      {
      headers: {
            
        }
      }
    )
  .then(response => {
          res.send(response.data);
              })
                  .then(response => {

                      })
                          .catch(error => {
                            res.redirect('/error');
        });
 });

0 个答案:

没有答案