1

I've seen several similar issues reported on here, but none of the solutions or specific setups seem to be quite matching mine.

I have a React client that is calling a backend Framework Web API via apollo, which is setting an http only cookie that I am expecting to be sent back in all subsequent requests. The backend service is configured to accept the client domain as CORS origin and locally as well as when deployed to a test server this is all working fine.

I have now deployed both the client and back end service to separate Azure App Services and the cookie 'appears' to not be getting set on the client.

In the initial response headers I can see the cookie being set in set-cookie, but it is not then included in subsequent requests and does not appear in the applications tab in chrome tools.

My Apollo calls are specifying withCredentials: true

Any idea what the reason for this may be?

Edit. The response headers coming back from the initial API request are:

Access-Control-Allow-Credentials: true
Access-Control-Allow-Origin: https://my-app-service.azurewebsites.net
Cache-Control: no-cache
Content-Encoding: gzip
Content-Length: 256
Content-Type: application/json; charset=utf-8
Date: Fri, 29 Oct 2021 12:04:27 GMT
Expires: -1
Pragma: no-cache
Server: Microsoft-IIS/10.0
Set-Cookie: {Cookie-Name}={JWT-Token}; expires=Fri, 29-Oct-2021 12:24:27 
GMT; path=/; HttpOnly
Vary: Accept-Encoding
X-AspNet-Version: 4.0.30319
X-Powered-By: ASP.NET
Stewart Alan
  • 1,521
  • 5
  • 23
  • 45
  • Could you share the API response that should be setting the cookie? You can check in the browser developer tools --> network. And are there any related errors in the console? – fvd2 Oct 29 '21 at 10:26
  • @fvd2 Ive added to the original post – Stewart Alan Oct 29 '21 at 12:08
  • Did you replace the actual {Cookie-Name} and {JWT-Token} values in the snippet with these placeholder values, i.e. is the client receiving the correct cookie name and value? – fvd2 Nov 01 '21 at 08:07
  • @StewartAlan did you manage to resolve this? We're encountering the same thing – Jonathan Robbins Aug 17 '22 at 11:07

0 Answers0