ASP.NET Core Sharing Identity Cookie across azure web apps on default domain (*.azurewebsites.net)

前端 未结 1 806
暗喜
暗喜 2021-01-15 20:26

Having trouble sharing an Identity Cookie (using ASP.NET Core v2) across multiple web applications

On my development environment, cookies are shared automatically (a

相关标签:
1条回答
  • 2021-01-15 21:27

    However, when I deploy the main site (the one that generates cookies from logins) to Azure, I can't even login. The .AspNetCore.Application.Identity cookie doesn't even get returned after entering username/password (or social logins)

    I searched the web and found that some domain names do not allowed to create cookies for security concerns. Domains for Azure Cloud are listed as follows:

    azurewebsites.net
    azure-mobile.net
    cloudapp.net
    

    Detailed list of domains you could find here.

    Moreover, if you want to share cookie among your multiple web apps, you could map custom domain name for your web apps (e.g. app1.yourwebsite.com, app2.yourwebsite.com) and set options.Cookie.Domain to .yourwebsite.com, details about mapping a custom domain you could follow here. Also, you need to configure data protection to use the same encryption keys for your multiple web apps. In addition, you could follow this similar issue.

    0 讨论(0)
提交回复
热议问题