1

将我的项目移动到 MVC Core RC2 后,我无法通过外部 Microsoft 帐户登录……其他一切正常,包括通过 Google 帐户登录。

它在 RC1 上完美运行,在移至 RC2 后,我的这部分代码没有直接改变,当然我使用新的中间件 - 此外,我已将身份验证包更新为 RC3,但仍然存在同样的问题。

我很确定我的项目/参考/包/等。因为我在安装 RC2 后创建了新的/干净的项目。

这是我的代码表格Startup.cs

...

app.UseIdentity();

// External Authentication
app.UseGoogleAuthentication(new GoogleOptions
{
     ClientId = Configuration["Authentication:Google:ClientId"],
     ClientSecret = Configuration["Authentication:Google:ClientSecret"],
     AutomaticAuthenticate = false
});

app.UseMicrosoftAccountAuthentication(new MicrosoftAccountOptions
{
     ClientId = Configuration["Authentication:MicrosoftAccount:ClientId"],
     ClientSecret = Configuration["Authentication:MicrosoftAccount:ClientSecret"],
     AutomaticAuthenticate = false
});

...

首次登录后,我可以看到有关权限的标准问题:

MS 帐户权限

接下来我有一个错误:

An unhandled exception occurred while processing the request.

Exception: OAuth token endpoint failure: Status: BadRequest;Headers: Pragma: no-cache
 x-ms-request-id: 5d12a6bf-2178-42bc-9e51-7aa73b1d6c9e
 client-request-id: 05f7532f-0075-438f-80e4-efd85b641bde
 x-ms-gateway-service-instanceid: ESTSFE_IN_131
 X-Content-Type-Options: nosniff
 Strict-Transport-Security: max-age=31536000; includeSubDomains
 Cache-Control: no-store, no-cache
 P3P: CP="DSP CUR OTPi IND OTRi ONL FIN"
 Set-Cookie: x-ms-gateway-slice=productiona; path=/; secure; HttpOnly, stsservicecookie=ests; path=/
 Server: Microsoft-IIS/8.5
 X-Powered-By: ASP.NET
 Date: Fri, 03 Jun 2016 23:11:55 GMT
 ;Body: {"error":"invalid_request","error_description":"AADSTS90019: No tenant-identifying information found in either the request or implied by any provided credentials.\r\nTrace ID: 5d12a6bf-2178-42bc-9e51-7aa73b1d6c9e\r\nCorrelation ID: 05f7532f-0075-438f-80e4-efd85b641bde\r\nTimestamp: 2016-06-03 23:11:56Z","error_codes":[90019],"timestamp":"2016-06-03 23:11:56Z","trace_id":"5d12a6bf-2178-42bc-9e51-7aa73b1d6c9e","correlation_id":"05f7532f-0075-438f-80e4-efd85b641bde"};

Unknown location

AggregateException: Unhandled remote failure.

Microsoft.AspNetCore.Authentication.RemoteAuthenticationHandler`1.<HandleRemoteCallbackAsync>d__5.MoveNext()

每次下一次登录尝试都会出现相同的错误(但未请求许可)。

有什么问题?

提前感谢您的任何建议。

4

1 回答 1

1

由于这对我很重要,我在 GitHub 上打开了问题 #866 :通过 Microsoft 帐户进行外部登录在 RC2/RC3 上失败

我会保持这个线程更新;)


更新:

就像@Tratcher 写道:

MicrosoftAccount 已移至新的 v2 端点,这需要重新注册您的应用程序Active Directory v2 App Registration


就我而言,这是解决方案。在我的应用程序门户上注册新应用程序后,一切正常。

谢谢拖拉机。

于 2016-06-04T20:01:00.170 回答