谢谢大家。
最后,我找到了一个解决方案。
第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/
转到“设置”选项卡设置回调URL
http://google.com
然后,它对我有效。我不知道为什么我需要设置回调URL。在我设置了任何值之后,我不能设置空值。所以,我认为这是推特API的错误。
asp-net-mvc-5-owin-twitter-auth-throwing-401-exception