401 Error Declared as Fixed

Coordinator
Apr 11, 2011 at 8:06 PM

For those of you who were experiencing problems with 401 errors during authentication, Twitter has announced that it is fixed.  Here are the details:

http://code.google.com/p/twitter-api/issues/detail?id=2118#c61

Joe

Apr 11, 2011 at 8:16 PM

Aleluia!

Apr 12, 2011 at 12:12 PM

I tried with the WebFormsDemo and I still have the 401 error (on the return statment of the WebResponseGet function).

So this is due to something else ?

Coordinator
Apr 12, 2011 at 3:34 PM
Edited Apr 12, 2011 at 3:35 PM

It might or might not be.  You receive a 401 Unauthorized when authentication at Twitter fails.  The bug had to do with a Twitter error in timing during OAuth authentication.  Here's a couple ways to approach the problem:

1.  If you can either switch from https to http or add a 15 second delay before CompleteAuthorization, then it sounds like the Twitter bug isn't fully fixed.  In that case, grab the value of "X-Transaction-ID" from the failed request.  The X-Transaction-ID can be obtained from the TwitterContext instance's ResponseHeaders property (it's a dictionary of all the headers that Twitter returns) or from Fiddler.  Give the X-Transaction-ID to Twitter so they can track down your particular problem.  You can use the URL above to add to their current issue or open a new issue.  If this looks like the Twitter bug and you go this route, it would be good if you could post the URL here so that I can watch the issue too, in case there's something I can do about it too.

2. If the 401 is happening all the time, you might have a problem with login credentials.  Things to look at include:

    - Double check your credentials to ensure they don't have spaces before or after (I've done this).

    - Check your Twitter application credential settings to ensure you have read and write (occasionally, someone will have theirs set to read-only and try to do an update, which doesn't work because their credentials can't so a write).

    - Make sure your credentials are correct.  i.e. what if you've re-keyed and accidentally used old keys.

3. If it still isn't working, post a sample that reproduces your problem here.  Don't include the whole program, just enough to see how you're implementing the OAuth dance and explain where the exception is raised.  A stack trace, ex.ToString(), might help too.

Joe

Apr 12, 2011 at 5:14 PM

Thanks for you reply !

In fact it was not the credentials but the Application Type.

When I registered the application I checked Browser but I didn't fill the Callback URL.

So it come back to Client. Now with Browser and the Callback URL it seems to work fine !

Coordinator
Apr 12, 2011 at 5:37 PM

Thanks for the follow-up.  It looks like I'm getting a workable list of troubleshooting tips for this set of errors.

Joe