首页 > 解决方案 > ASP核心版本3中的Facebook登录异常

问题描述

我在 asp core 3 应用程序中设置了 Facebook 登录。当我点击 Facebook 登录按钮时,该网站重定向到 Facebook 登录页面,但是当它重定向回来时,我得到了这个异常页面:

找不到方法:'System.Text.Json.JsonDocument System.Text.Json.JsonDocument.Parse(System.String, System.Text.Json.JsonReaderOptions)'

这是代码:

  1. 在启动时添加服务
services.AddAuthentication().AddFacebook(facebookOptions =>
            {
                facebookOptions.AppId = Configuration["Authentication:Facebook:AppId"];
                facebookOptions.AppSecret = Configuration["Authentication:Facebook:AppSecret"];
            });
  1. 在用户密码中添加详细信息:
{
  "Authentication:Facebook:AppId": "000000000000",
  "Authentication:Facebook:AppSecret": "0000ada00000asasd00"
}

常规的身份验证过程工作得很好。只有当我尝试使用 Facebook 登录时,才会收到此错误。

另外,我读到 .NET Core 3.0 中的 JSON 支持还没有完成,所以我尝试使用 NewtonsoftJson 包,但问题没有解决。

标签: c#asp.netfacebookasp.net-corefacebook-login

解决方案


推荐阅读