【发布时间】:2020-09-01 12:56:32
【问题描述】:
我正在尝试使用 Google API 对 ASP.NET Core 进行身份验证,以便能够访问人员 api。
我有以下代码:
services.AddAuthentication()
.AddOpenIdConnect(GoogleDefaults.AuthenticationScheme,
GoogleDefaults.DisplayName,
options =>
{
options.Authority = "https://accounts.google.com/o/oauth2/v2/auth";
options.ClientId = Configuration["Authentication:Google:ClientId"];
options.ClientSecret = Configuration["Authentication: Google:ClientSecret"];
options.ResponseType = OpenIdConnectResponseType.Code;
options.Scope.Add("openid");
options.Scope.Add("email");
options.CallbackPath = "/signin-google";
});
问题是我得到以下异常
处理请求时发生未处理的异常。
IOException:IDX20807:无法从以下位置检索文档:'[PII 被隐藏。有关更多详细信息,请参阅 https://aka.ms/IdentityModel/PII.]'。 HttpResponseMessage: '[PII 被隐藏。有关更多详细信息,请参阅 https://aka.ms/IdentityModel/PII.]', HttpResponseMessage.Content: '[PII 已隐藏。有关更多详细信息,请参阅 https://aka.ms/IdentityModel/PII。]'
我该如何解决这个问题?
第二个问题:如何从控制器访问访问令牌以便能够向 People API 发送请求?
最好的问候, 迈克
【问题讨论】:
-
所以你从异常转到链接?
标签: c# asp.net-core authentication