且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Identity Server 4(2.0)无法读取Asp.Net Core身份cookie

更新时间:2023-02-16 11:33:13

今天早上我终于弄清楚了这个问题.部分原因是由于我有一个使用IdentityConstant cookie的自定义登录管理器.

I finally figured out the problem this morning. Part of the problem was due to the fact that I have a custom signin manager which uses the IdentityConstant cookies.

services.AddAuthentication(options =>
                {
                    options.DefaultAuthenticateScheme = IdentityConstants.ApplicationScheme;
                    options.DefaultChallengeScheme = IdentityConstants.ApplicationScheme;
                })

需要同时设置DefaultAuthenticateScheme和DefaultChallengeScheme.然后一切都会正常进行.

Both DefaultAuthenticateScheme and DefaultChallengeScheme need to be set. Then everything works as it should.