[英]External Authentication with ASP.NET Web API 2 - Microsoft not working now
I configured External Authentication Services within my ASP.NET Web Api 2 successfully for Facebook, Google, Microsoft & Twitter about a year ago. 大约一年前,我在ASP.NET Web Api 2中成功为Facebook,Google,Microsoft和Twitter配置了外部身份验证服务。 Revisiting recently I was quickly able to get everything working again for everything besides Microsoft. 最近回访时,我很快就能够使除Microsoft之外的所有内容重新正常运行。 I originally followed a tutorial similar to this one . 我最初遵循的教程与此相似。
The first error I was getting was below - 我遇到的第一个错误是-
/api/Account/ExternalLogin?provider=Microsoft&response_type=token&redirect_uri=https%3A%2F%2Fwww.censored.com%2Fapi%2FAccount%2FAuthComplete&state=PgiSt-woFC7HSvc990RM5RXVdkW_ozDKy3PDpDeyeAU1&client_id=censored& error=access_denied HTTP/1.1" 302 0 " https://login.live.com/oauth20_authorize.srf?client_id=0000000 /api/Account/ExternalLogin?provider=Microsoft&response_type=token&redirect_uri=https%3A%2F%2Fwww.censored.com%2Fapi%2FAccount%2FAuthComplete&state=PgiSt-woFC7HSvc990RM5RXVdkW_ozDKy3PDpDeyeAU1&client_id=censored& 误差= ACCESS_DENIED HTTP / 1.1" 302 0“ https://开头login.live.com/oauth20_authorize.srf?client_id=0000000
I deleted the app at https://apps.dev.microsoft.com thinking re-adding it may fix the problem to discover I was unable to re-add it in such a way as to generate a ClientId & Client Secret. 我在https://apps.dev.microsoft.com上删除了该应用程序,以为重新添加该应用程序可能会解决问题,发现我无法以生成ClientId和Client Secret的方式重新添加它。 Has Microsoft support for OAuth completely changed and what do I have to do now? Microsoft对OAuth的支持是否已完全更改,我现在该怎么办?
Here is part of Startup class that shows how I am configuring Facebook & Microsoft OAuth. 这是Startup类的一部分,显示了我如何配置Facebook和Microsoft OAuth。
public partial class Startup
{
public static OAuthAuthorizationServerOptions OAuthOptions { g
// For more information on configuring authentication, please
public void ConfigureAuth(IAppBuilder app)
{
// working
var fbook = new FacebookAuthenticationOptions
{
AppId = "sadfsda",
AppSecret = "dsfsadf"
};
app.UseFacebookAuthentication(fbook);
// not working
var msoft = new MicrosoftAccountAuthenticationOptions
{
ClientId = "sadf",
ClientSecret = "zdfsdf",
};
app.UseMicrosoftAccountAuthentication(msoft);
I was able to fix this after reading some of the comments from the GitHub link. 阅读GitHub链接中的一些评论后,我能够解决此问题。 I created a new App at https://apps.dev.microsoft.com skipping the guided setup. 我在https://apps.dev.microsoft.com上创建了一个新的应用程序,跳过了指导设置。 Then I retrieved the password with the Generate New Password button. 然后,我使用“ 生成新密码”按钮检索了密码。 This and the application Id (a guid) I used for the ClientId and ClientSecret. 这以及我用于ClientId和ClientSecret的应用程序ID(GUID)。 Added a Redirect URL eg 添加了重定向URL,例如
https://www.sadfsdaf.com/signin-microsoft
and it worked. 而且有效。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.