如何获取会话ID?

时间:2020-03-06 23:21:15

标签: odoo-13

我正在使用axios进行发布请求

getSessionId() {
  const endpoint = 'http://localhost:8069/web/session/authenticate/'
  axios.post(endpoint, this.user).then((response) => {
    this.cookie = response.headers
    console.log(response.headers)
  })
}

我知道会话ID是作为cookie的en标头,在vs代码的终端中我得到了

  {                                                                                                                                                                                                       
     'content-type': 'application/json',
     'content-length': '1355',
     'access-control-allow-origin': '*',
     'access-control-allow-methods': 'POST',
     'set-cookie': [
         'session_id=b459a3fe46e0b32b039b6ebded4db308472abbb4;
         Expires=Thu, 04-Jun-2020 23:11:29 GMT; Max-Age=7776000;
         HttpOnly; Path=/'
      ],
     server: 'Werkzeug/0.16.0 Python/3.7.3',
     date: 'Fri, 06 Mar 2020 23:11:29 GMT'
}

但是当我控制台登录浏览器的响应时,它会给我

{
  content-length: "1355"
  content-type: "application/json"
}

0 个答案:

没有答案