403 Forbidden Error Again


#1

Hello,

We have been using the Twitter OAuth2 process for months and all of sudden we are getting the “403 Forbidden” error. We are getting this on several Consumer Keys.

Here is the code we are using (which has been working fine for months)

var authHeaderFormat = “Basic {0}”;

var authHeader = string.Format(authHeaderFormat,
Convert.ToBase64String(Encoding.UTF8.GetBytes(string.Format("{0}:{1}",
Uri.EscapeDataString(oAuthConsumerKey), Uri.EscapeDataString((oAuthConsumerSecret))))));

var postBody = “grant_type=client_credentials”;

HttpWebRequest authRequest = (HttpWebRequest)WebRequest.Create(oAuthUrl);
authRequest.Headers.Add(“Authorization”, authHeader);
authRequest.Method = “POST”;
authRequest.ContentType = “application/x-www-form-urlencoded;charset=UTF-8”;
authRequest.AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate;

using (System.IO.Stream stream = authRequest.GetRequestStream())
{
byte[] content = ASCIIEncoding.ASCII.GetBytes(postBody);
stream.Write(content, 0, content.Length);
}

authRequest.Headers.Add(“Accept-Encoding”, “gzip”);

WebResponse authResponse = authRequest.GetResponse();

NOTES

  • We are not posting any with this code. We are only reading in timelines.
  • We are receiving the 403 error on several accounts on both our Production and Dev sites (which has very little, if any traffic) so I doubt it’s a rate limit issue.

Any help would be great as this is affecting our production sites!

  • Bryan

#2

Hi Bryan, let me check if I understood correctly:

This code you pasted above with an implementation of Oauth2 client_credentials signature was working and suddenly, without any change to that code, the application started to get 403 statuses in the responses?


#3

That is correct. We have had this code in place since Jan and everything was fine until a few days ago. I tried to create a new app in my account and use those credentials but all of the requests (regardless off which app consumer key we use) return a 403.


#4

It’s also worth noting that in my “Apps” section, clicking on “Test OAuth” takes me to the “https://dev.twitter.com/apps/6864400/oauth” with this message:

OAuth Tool Temporarily Down
The “OAuth Tool” that generates OAuth signatures for your apps to access specific endpoints (e.g., for testing as cURL commands) is temporarily down as we update the Twitter Developers site. Hang tight! It should be back soon.

Seeing this tells me there might be a problem with the Twitter OAtuh service, however, I can’t find a single post about anyone else having a problem which tells me it’s something specific to our account.


#5

The Oauth tool is a known issue due to this site migration, this will be solved soon. It’s not related to the problem you are having

Can you inform the name of the app and Twitter handle associated?


#6

Currently we have the problem with 3 apps:

Twttier Handle: BitWIzards

IMG Models Dev
IMG Models QA
IMG Models Prod

Thanks!


#7

Will investigate and return soon. Thanks for the info


#8

Awesome! Thank you for looking into. We were using a different Twitter account / App name before the ones above, however, got the same error. That is why we created the Apps above and used our Twitter account.


#9

Any luck on this? We are still unable to pull any timelines into our production site because of this issue. Thank you for any update you can provide!


#10

Hello again. I hadn’t seen any response in over a week and we are still having the 403 issue. Is there any update on this? Thank you for all your help!