MVC Core RC2,通过微软账户外部登录
MVC Core RC2, External login via Microsoft Account
将我的项目移动到 MVC Core RC2 后,我无法通过外部 Microsoft 帐户登录...其他一切正常,包括通过 Google 帐户登录。
它在 RC1 上运行完美,在移动到 RC2 后我的这部分代码没有直接改变,当然我使用了新的中间件 - 而且我已经将身份验证包更新到 RC3 并且仍然有同样的问题。
我很确定我的 project/references/packages/etc。因为我在安装 RC2 之后创建了 new/clean 项目。
这是我的代码形式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
});
...
首次登录后,我可以看到有关权限的标准问题:
接下来我有一个错误:
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()
每次下一次登录尝试都会出现相同的错误(但没有请求许可)。
有什么问题吗?
提前感谢您的任何建议。
因为它对我很重要,所以我打开了issue #866 on GitHub: External login via Microsoft Account failed on RC2/RC3
我会持续更新此帖 ;)
更新:
就像@Tracher 写的那样:
MicrosoftAccount was moved to the new v2 endpoints which requires re-registering your application Active Drectory v2 App Registration
这是我的解决方案。在 My applications 门户上注册新应用后,一切正常。
谢谢特拉彻。
将我的项目移动到 MVC Core RC2 后,我无法通过外部 Microsoft 帐户登录...其他一切正常,包括通过 Google 帐户登录。
它在 RC1 上运行完美,在移动到 RC2 后我的这部分代码没有直接改变,当然我使用了新的中间件 - 而且我已经将身份验证包更新到 RC3 并且仍然有同样的问题。
我很确定我的 project/references/packages/etc。因为我在安装 RC2 之后创建了 new/clean 项目。
这是我的代码形式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
});
...
首次登录后,我可以看到有关权限的标准问题:
接下来我有一个错误:
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()
每次下一次登录尝试都会出现相同的错误(但没有请求许可)。
有什么问题吗?
提前感谢您的任何建议。
因为它对我很重要,所以我打开了issue #866 on GitHub: External login via Microsoft Account failed on RC2/RC3
我会持续更新此帖 ;)
更新:
就像@Tracher 写的那样:
MicrosoftAccount was moved to the new v2 endpoints which requires re-registering your application Active Drectory v2 App Registration
这是我的解决方案。在 My applications 门户上注册新应用后,一切正常。
谢谢特拉彻。