0

I am developing a project in which to frontend using the angular 2 and on the backend using the symfony as api , my problem and that when i try to do a resquest for symfony must send the PHPSESSID and this is not happening as you can see in the picture below.

enter image description here

I have looked on the internet and appears much to use withCredentials:true but it is always to give this error.

enter image description here

Someone can help me?

The cookie from the PHPSESSID exists

Matthew Green
  • 10,161
  • 4
  • 36
  • 54
user26776
  • 131
  • 3
  • 12

1 Answers1

0

Are you passing headers in the option when making the request? See below sample -

var body; // request body
let headers = new Headers({ 'Content-Type': 'application/json',
                            'Access-Control-Allow-Credentials':'true' });
let options = new RequestOptions({ headers: headers });
        return this.http.post(this.baseUrl, body, options)
            .map(response => response);

I am not sure if this would work for you but I had similar problem with CORS. Find more information about Access-Control-Allow-Credential header in this thread.

Community
  • 1
  • 1
Akash
  • 4,412
  • 4
  • 30
  • 48