1. 登陆成功设置cookie (服务端 通过 json返回 token)

//设置cookie
document.cookie = "JSESSIONID="+data.data.token+";path=/;domain="+urlcore.split('://')[1].split(':')[0];

注: data.data.token 服务端返回的token

       urlcore 接口访问统一路径 例子:http://127.0.0.1:8080/api......

2.请求相应接口时 设置withCredentials为true

如下为 jquery的ajax设置方式:

            ...   
            dataType: 'json',
            xhrFields: {
                withCredentials: true
            },
            ...

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-01
  • 2021-06-09
  • 2022-01-06
  • 2021-06-01
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-10-03
  • 2022-12-23
  • 2021-11-01
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案