'How to Secure Cookie in MVC

I have an application in MVC which is consuming some third party APIs. While running application on server I am getting below 4 cookies in browser and one of them (OPENIAM_AUTH_TOKEN) is not set secure. So How can I set secure flag and also if you can let me know who might be generating this cookie since in my application it is not mentioned anywhere.

enter image description here

I have set below in my Web.Config file already :

httpCookies httpOnlyCookies="true" requireSSL="true"



Solution 1:[1]

You can try add below to your AddCookie

Cookie.SecurePolicy = CookieSecurePolicy.Always

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Ng?c Hòa