public async Task <ActionResult <TokenResponseDTO> > GetToken(LoginDTO credentials) { if (credentials == null) { return(BadRequest("No credentials were found")); } var user = await _userManager.FindByEmailAsync(credentials.Username); var refreshToken = await _tokenService.GenerateRefreshToken(user.Id); HttpContext.Response.Cookies.Append("MyKey", refreshToken.Token, new CookieOptions { HttpOnly = true, Expires = DateTimeOffset.FromUnixTimeMilliseconds(refreshToken.Expiration), IsEssential = true, SameSite = SameSiteMode.None, Secure = true }); var accessToken = new TokenResponseDTO { Token = await _tokenService.RequestToken(credentials) }; return(Ok(accessToken)); }