为什么我使用ASP.Net身份从Twitter收到错误403响应?

时间:2019-07-07 05:52:14

标签: c# asp.net authentication twitter oauth

2017年我被锁定时,我使用的是ASP.Net Identities,以便人们可以使用其Twitter和Facebook帐户注册我的网站。

现在我可以出门了,并且可以再次使用计算机,但是注册功能已损坏。对于Twitter,我得到的是以下错误消息: 403错误

我的Startup.Auth.cs文件包括以下内容:

app.UseTwitterAuthentication(new TwitterAuthenticationOptions
             {
                 ConsumerKey = "mynewkey",
                 ConsumerSecret = "mynewsecret",
                  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 CA - 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
               })
              });

响应状态代码不指示成功:403(禁止)。   说明:执行当前Web请求期间发生未处理的异常。请查看堆栈跟踪,以获取有关错误及其在代码中起源的更多信息。

异常详细信息:System.Net.Http.HttpRequestException:响应状态代码未指示成功:403(禁止访问)。

源错误:

  

在执行当前Web请求期间生成了未处理的异常。可以使用下面的异常堆栈跟踪来标识有关异常的来源和位置的信息。

堆栈跟踪:

  

[HttpRequestException:响应状态代码不指示成功:403(禁止)。]      System.Net.Http.HttpResponseMessage.EnsureSuccessStatusCode()+121514      Microsoft.Owin.Security.Twitter.d__21.MoveNext()+2525      System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务任务)+13847892   System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务)+61      Microsoft.Owin.Security.Twitter.d__10.MoveNext()+1133      System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务任务)+13847892   System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务)+61      Microsoft.Owin.Security.Infrastructure.d__b.MoveNext()+380      System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务任务)+13847892   System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务)+61      Microsoft.Owin.Security.Infrastructure.d__8.MoveNext()+494      System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务任务)+13847892   System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务)+61      Microsoft.Owin.Security.Infrastructure.d__5.MoveNext()+218      System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务任务)+13847892   System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务)+61      Microsoft.Owin.Security.Infrastructure.d__0.MoveNext()+975      System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务任务)+13847892   System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务)+61      Microsoft.Owin.Host.SystemWeb.IntegratedPipeline.d__5.MoveNext()+203      System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务任务)+13847892   System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务)+61      Microsoft.Owin.Security.Infrastructure.d__0.MoveNext()+774      System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务任务)+13847892   System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务)+61      Microsoft.Owin.Security.Infrastructure.d__0.MoveNext()+774      System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务任务)+13847892      System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务)+61      Microsoft.Owin.Host.SystemWeb.IntegratedPipeline.d__5.MoveNext()+203      System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务任务)+13847892      System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务)+61      Microsoft.Owin.Host.SystemWeb.IntegratedPipeline.d__2.MoveNext()+193      Microsoft.Owin.Host.SystemWeb.IntegratedPipeline.StageAsyncResult.End(IAsyncResult ar)+96      System.Web.AsyncEventExecutionStep.OnAsyncEventCompletion(IAsyncResult ar)+116


版本信息:Microsoft .NET Framework版本:4.0.30319; ASP.NET版本:4.6.1055.0

0 个答案:

没有答案