I am working with angular 2 and I make requests for symfony only that the problem and that when I make certain requests the syfomy loses the sessions but from afar to far it works I do not know what it can be I will leave below a request that works and another That does not work if you can help me I'd be grateful
this works
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());
}
This does not work.
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());
}
add this to config.yml
:
framework:
session:
cookie_domain: ".YOUR_DOMAIN"
name: SFSESSID
cookie_httponly: false