How to mark the cookie from AAD B2C to be secure?

Carol Lai 521 Reputation points
2021-09-23T15:04:59.977+00:00

Our app service uses custom policy to log in through AAD B2C and receive the authentication from it. Since it's a cross-site cookie, we need to mark it SameSite=None with the Secure attribute,

I read that AAD B2C supports this attribute based on the following document.
https://learn.microsoft.com/en-us/azure/active-directory-b2c/cookie-definitions

How to configure this cookie from AAD B2C with the secure attribute?

Microsoft Entra External ID
Microsoft Entra External ID
A modern identity solution for securing access to customer, citizen and partner-facing apps and services. It is the converged platform of Azure AD External Identities B2B and B2C. Replaces Azure Active Directory External Identities.
2,663 questions
{count} votes

Accepted answer
  1. Loki Mutua 76 Reputation points
    2021-09-28T12:29:23.71+00:00

    @Carol Lai

    Could you add this snippet in your startup.cs file under cookie options configuration and let me know if this fixes the issue.

    options.Secure = CookieSecurePolicy.Always;


0 additional answers

Sort by: Most helpful