Computer Services
  • Local Businesses Offer
  • Trusted Partners
  • Services & Solutions
  • Local Businesses Offer
  • Trusted Partners
  • Services & Solutions

Twitter returns (401) Unauthorized when trying to post using Kentico CMSDesk

I thought it was time to start using the integrated Twitter feature in Kentico CMS 7.x. In doing so I ran into a problem where Twitter kept returning (401) Unauthorized errors in the CMSSitemanager Log.

The setup for Twitter as well as the other supported social networks is relatively painless in CMSSitemanager. All you have to do is generate your keys, plug them in and you are good to go. Well, maybe...

Problem:
So you created your blog post, put in some catchy phrases or sentences for Twitter and then hit publish. To your surprise you get the following, and not really clear for the reader, error messages during Save/Publish operations:

  • An error occurred during the document action. Please see event log for more details.
  • The object state has been changed by someone else. Please repeat the action if necessary.

If you are authorized to goto CMSSiteManager you then view the stack trace in the Event Log and see the following:
  • An error occurred during the document action. Please see event log for more details. Message: The remote server returned an error: (401) Unauthorized.

From CMSDesk the messaging is not very clear in my opinion. When you look at the event log you get a clue that you are not an authorized user. So naturally the next steps you may want to take is:
  • Verify you copied and pasted the keys correctly
  • You gave the appropriate access level to your Twitter application you created 
You try again and it fails...

It's errors like these that can drive you up a wall and burn a lot of time. I searched around and came across a post on the Twitter Developers Discussion forum, which can be found here, and found the solution.

I do not know why, but apparently when you create your new Twitter application you DO NOT click "create access tokens". You must first go to Settings and set the permissions to "Read, Write and Access direct message". Once you have done this you can go back and create the access tokens.

This thread also has some other handy tips in there as well for filling in some of the blank fields regardless of whether you use them or not.

For the sake of thouroughness I did not try to regenerate any of the keys or tokens. Instead I deleted the Twitter application and then recreated the Twitter application again.

Guess what? It finally worked :-)
Posted: 1/3/2013 4:00:24 PM by Proxy Consulting | with 0 comments
Filed under: CMSDesk, CMSSiteManager, Kentico CMS, Social Media, Twitter, Twitter Application, Web Site Development
Trackback URL: http://www.proxycg.com/trackback/d63528e1-b18c-43c9-b093-d5aaa543a139/Twitter-returns-(401)-Unauthorized-when-trying-to-post-using-Kentico-CMSDesk.aspx?culture=en-US

Comments
Blog post currently doesn't have any comments.

Blogging Technology

Kentico CMS, WordPress, C#, ASP.NET, Windows Server, Windows, SQL Server, Computer Security and other technology related articles.

Resources

A blog about technology in general and how-to articles.

Syndication