I am implementing refreshToken in my ASP.NET CORE WEB API + React application and I can't figure out how to send this token back to my API with another request.
My API adds refreshToken as HttpOnly cookie to requests.
- Api endpoint
[HttpPost]
[AllowAnonymous]
public async Task<IActionResult> GenerateToken([FromForm]LoginModel model)
{
var result = await _userService.GetTokenAsync(model);
SetRefreshTokenInCookie(result.RefreshToken);
return Ok(result);
}
- Adding refresh token to response
private void SetRefreshTokenInCookie(string refreshToken)
{
var cookieOptions = new CookieOptions
{
HttpOnly = true,
Expires = DateTime.UtcNow.AddDays(10)
};
Response.Cookies.Append("refreshToken", refreshToken, cookieOptions);
}
I can see cookie with refreshToken while browsing 'Network' in my chrome dev tools.

But there is no cookie in 'Application'
And there is no cookie in next request as well.
I am using Axios to send requests. How can I get that refreshToken in my backend?


axios.get('some api url', {withCredentials: true});try using withcredentials