Cookie set from API is not included in callback
- Dominant language
- No language data
- Stars
- 346
- Forks
- 67
- PR merge metrics
- No merged PRs in 30d
Description
Hi!
I have developed a quickstart template for Azure Static Web App / Hugo / Netlify CMS.
https://github.com/jahlen/hugo-azure-static-webapp
It implements Netlify CMS to GitHub authentication via an Azure Function (found under /api/OAuth.cs). For the OAuth authentication, I tried saving the state in a cookie, but it won't work. Here's my code where I set the cookie:
``` csharp
[FunctionName("Auth")]
public static IActionResult Auth(
[HttpTrigger(AuthorizationLevel.Anonymous, "get", Route = null)] HttpRequest req,
ILogger log)
{
var state = CreateRandomString();
req.HttpContext.Response.Cookies.Append(CookieName, state, new CookieOptions { HttpOnly = true, SameSite = SameSiteMode.Lax, Secure = true});
var authorizationUrl = $"{AuthorizationUrl}?response_type=code&client_id={ClientId}&redirect_uri={WebUtility.UrlEncode(RedirectUri)}&scope={WebUtility.UrlEncode(Scope)}&state={WebUtility.UrlEncode(state)}";
return new RedirectResult(authorizationUrl);
}
```
The problem is that the cookie is NOT included when the users is sent to the redirect_uri, even if it is on the same domain. If I manually go to the redirect_uri in my browser, the cookie will be included. Maybe this is a difference in behavior between strict and lax? I note that it sets *samesite* to *strict* even if I specify it to be *lax*.

Anything wrong I am doing with the cookie?
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.