无法使用 Twitter 身份验证

Can Not Use Twitter Authentication

我正在通过 ASP.NET MVC 实现 Twitter 身份验证。

app.UseTwitterAuthentication(new TwitterAuthenticationOptions()
{
       ConsumerKey = "XXX",
       ConsumerSecret = "XXX",
});

当我点击 link http://localhost:55586/Account/Login?ReturnUrl=%2F 我遇到了如下图所示的错误: 我不知道我是否错过了什么。 []

谢谢大家。 终于找到解决方法了

第 1 步:

app.UseTwitterAuthentication(new TwitterAuthenticationOptions()
{
    ConsumerKey = "XXX",
    ConsumerSecret = "XXX",
    BackchannelCertificateValidator = new Microsoft.Owin.Security.CertificateSubjectKeyIdentifierValidator(new[]
    {
       "A5EF0B11CEC04103A34A659048B21CE0572D7D47", // VeriSign Class 3 Secure Server CA - G2
       "0D445C165344C1827E1D20AB25F40163D8BE79A5", // VeriSign Class 3 Secure Server CA - G3
       "7FD365A7C2DDECBBF03009F34339FA02AF333133", // VeriSign Class 3 Public Primary Certification Authority - G5
       "39A55D933676616E73A761DFA16A7E59CDE66FAD", // Symantec Class 3 Secure Server CA - G4
       "‎add53f6680fe66e383cbac3e60922e3b4c412bed", // Symantec Class 3 EV SSL CA - G3
       "4eb6d578499b1ccf5f581ead56be3d9b6744a5e5", // VeriSign Class 3 Primary CA - G5
       "5168FF90AF0207753CCCD9656462A212B859723B", // DigiCert SHA2 High Assurance Server C‎A 
       "B13EC36903F8BF4701D498261A0802EF63642BC3" // DigiCert High Assurance EV Root CA
     }),
});

运行 再次项目。我遇到了如下错误:

第 2 步:

https://apps.twitter.com/
Go to the Settings Tab Set a Callback URL to any website. Even if it is not real

=> I set it to http://google.com

那么,它对我有用。不知道为什么要设置Call​​backURL。在我设置任何值后,我不能设置空值。所以,我认为这是 Twitter 的错误 API。

asp-net-mvc-5-owin-twitter-auth-throwing-401-exception