会话和cookie与laravel 5.6.35不相关

时间:2018-08-31 14:34:09

标签: php laravel

我的详细问题:

我有两个网站:

  1. 用于下订单
  2. 用于管理购买产品上的其他内容

并且我正在开发代理服务器,以将数据从一台服务器传递到两台服务器,并从两台服务器执行任何操作。

两个网站都在不同的平台和域上。

  • 服务器1-WordPress
  • 服务器2-Angular
  • 代理服务器-Laravel

从wordpress成功下达订单后,它将重定向url(角度门户的索引页)中的JWT令牌。

Angular调用我在laravel中内置的URL,以将令牌存储在会话或cookie中。

Laravel存储会话和cookie,但是当我返回对它们的真实响应时,Angular门户会重定向到“订单列表”页面(此处我的代理服务器失败,因为我在这里没有任何会话或cookie)。

任何帮助将不胜感激。

1 个答案:

答案 0 :(得分:0)

use this plugin:-js-cookie

set your jwt token in cookie using this plugin. 

this plugin work on domain and sub domain

you can  get cookie in angular and php both.

for set cookie :- 
  

Cookies.set('name',{foo:'bar'});

获取Cookie:-

  

Cookies.get('name'); // =>'{“ foo”:“ bar”}'

使用还可以使用php函数进入服务器端laravel:-

  

$ _ COOKIE ['名称']

相关问题