0

I have an ASP.NET Core Web API hosted on Azure with the link https://socialchainapi.azurewebsites.net/.

And NextJS app hosted on https://socialchain-client-api.vercel.app/ The problems:

I am trying to append cookies from the back-end as below - cookies options:

HttpOnly = true, Expires = refreshTokenExpiryDate, IsEssential = true, 
Secure = true, SameSite = SameSiteMode.None,

Appending the cookies from an HttpPost method :

Response.Cookies.Append("refreshToken", verifyResult.Value.User.RefreshToken, cookieOptionsRefreshToken); 
Response.Cookies.Append("accessToken", verifyResult.Value.AccessToken, cookieOptionsAccessToken);

var verifyResponse = new VerifyResponse(verifyResult.Value.User.AccountAddress, verifyResult.Value.AccessToken); 
return Ok(verifyResponse);

In the frontend (NextJS) I am receiving the cookies with no problem as below, but it is not set in the cookies storage.

Network response screenshot:

Network response

Console (no errors) screenshot:

Log

Browser cookies storage screenshot:

Cookies store

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
ahmed7am1d
  • 3
  • 1
  • 3
  • "Cookies created as a part of response of network calls are also listed, but only for calls that happened while the tool is open." – Andy Ray May 28 '23 at 16:46
  • @AndyRay what do you mean by that, did not understand sorry ?! – ahmed7am1d May 28 '23 at 16:53
  • That's from the documentation of the Firefox inspector storage tab. Also, are your API and site are on different domains? – Andy Ray May 28 '23 at 16:57
  • @AndyRay Aha ok, yes they are on different domains, thats why I am specifying (SameSite = SameSiteMode.None) – ahmed7am1d May 28 '23 at 17:01
  • Does this answer your question? [How to set a cookie for another domain](https://stackoverflow.com/questions/6761415/how-to-set-a-cookie-for-another-domain) – Andy Ray May 28 '23 at 20:03

0 Answers0