Insecure Cookie Issue in ASP.net code web API

Added below code to make the cookie secure,

Kindly help me to fix the issue.

public class Startup{

app.UseCookiePolicy(new CookiePolicyOptions
{
HttpOnly = Microsoft.AspNetCore.CookiePolicy.HttpOnlyPolicy.Always
});

}