【问题标题】:Symfony lose session when I make certain requests当我提出某些请求时,Symfony 失去会话
【发布时间】:2017-04-02 07:22:30
【问题描述】:

我正在使用 angular 2,我只对 symfony 提出问题,并且当我提出某些请求时,syfomy 会丢失会话,但从远到远它都有效,我不知道它会是什么我会离开下面一个有效的请求,另一个无效的请求,如果你能帮助我,我将不胜感激

这行得通

getOneEntidade(entid:number)
{
  this.token = this.cookieService.get("auth");

  let headers = new Headers({  'Content-Type': 'text/html' , 'Access-Control-Allow-Credentials': 'true', 'Authorization': 'Bearer ' + this.token});
  let options = new RequestOptions({ headers: headers, body: '', withCredentials: true});    
  return this.http.get(this.urlbase + "oneentidades/" + entid , options)
  .map((response: Response) => response.json());

}

这不起作用。

getpesquisa(pesquisa:string,  pag:number){

  this.token = this.cookieService.get("auth");

  let headers = new Headers({'Content-Type': 'text/html','Access-Control-Allow-Credentials': 'true', 'Authorization': 'Bearer ' + this.token});
  let options = new RequestOptions({ headers: headers, body: '', withCredentials: true});    
  return this.http.get(this.urlbase + "pesquisaentidades/" + pesquisa + "/" + pag , options)
  .map((response: Response) => response.json());
}

【问题讨论】:

    标签: php angularjs symfony session angular


    【解决方案1】:

    将此添加到config.yml:

    framework:
        session:
            cookie_domain: ".YOUR_DOMAIN"
            name: SFSESSID
            cookie_httponly: false
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-06-28
      • 1970-01-01
      • 1970-01-01
      • 2020-11-01
      • 1970-01-01
      相关资源
      最近更新 更多