« Open Melody: Movable Type Forked | Main | Google Wave Plugin for Movable Type? »

Twitter Commenters v2.1 - OAuth Bug Fixed

Twitter Commenters is a plugin for Movable Type that enables commenters to sign-in and comment on your blog using their Twitter account. Versions 2+ includes support for Twitter's OAuth authorization system and enables commenters to automatically share their comments to their Twitter stream.

Note: Version 2.1 fixes a serious bug when using OAuth, users would get a Comment Submission Error, saying that Name and Email are required. All sites running v2.0 should upgrade to v2.1 using the download link below. Simply upload the new files, no need to adjust settings or templates

Basic Auth (default):

OAuth:

Twitter comment authentication works like other auth methods in MT -- once you have installed the plugin you can enable Twitter as one of the auth options, as shown in the image above.

How It Works - Basic Auth

When the user enters their Twitter username and password in the form (shown above), the plugin submits those to the Twitter API to verfiy the credentials. If verified, the user can then post comments using their Twitter account. Their Twitter 'display name' will be shown beside their comments, and their Twitter avatar (profile photo) will be imported and shown beside their comments (if userpics are enabled in your templates).

Note that users' Twitter passwords are not stored in the MT database. An upcoming version of this plugin will enable Twitter's new OAuth support, in which case passwords would never be sent to MT at all. That version will like have an option for commenters to cc. their comments to their Twitter account. Stay tuned.

How It Works - OAuth

New in Version 2.0, you can optionally enable Twitter's new OAuth authorization system. With OAuth, user never have to submit their password info to your server. Instead, they click a "sign in with Twitter" button and they are taken to a page on Twitter.com asking them to authorize the application (see image above). One they click "Allow" they are returned to your site and they then post comments using their Twitter account. As with basic auth, their Twitter 'display name ' will be used as well as their Twitter avatar (profile photo).

Share Comments on Twitter

A new feature in version 2.0, only supported via OAuth, enables commenters to optionally share their comment to their Twitter stream. All they have to do is click a checkbox, no need to re-authorize or enter Twitter account info.

Try it Now

MT Hacks has the new OAuth method enabled. Try it now:

Click here to login with your Twitter account. After logging in, you will be returned to this entry, and you can leave a comment below.

Requirements

  • Net::Twitter 2.07 perl module (included with plugin) (note: do not upgrade to version 2.9+ of this module)
  • Net::Twitter::OAuth perl module (included with plugin)
  • Net::OAuth perl module (included with plugin)
  • Net::OAuth::Simple perl module (included with plugin)
  • JSON::Any perl (included with plugin)

Note: Net::Twitter requires newer versions of the libwww-perl collection of Perl modules. I am not sure what the minimum version required is, but on my server, I had to upgrade in order to get Net::Twitter to work. So if you get strange errors, try installing the latest version in your 'extlib' directory of your MT. Update: A common error message is: "Can't locate object method "default_header" via package "LWP::UserAgent" -- if you see this error, this the problem.

Download Twitter Commenters

Download Now
Downloads: 268

Installation

  1. Upload the contents of the 'plugins' folder to the 'plugins' directory for your MT install.
  2. Upload the contents of the 'mt-static' folder to your 'mt-static' directory.
  3. For each blog you want to enable, go to Preferences > Registration and check the box for 'Twitter'.

Enabling Twitter OAuth

Unfortunately, this is not as easy as it could be, maybe Twitter will make it easier in future. To set this up you need to create an Application on Twitter:

  1. While logged in to your Twitter account, go to http://twitter.com/oauth_clients/new.
  2. Fill out the form on that page:
    • Give it a unique name and description.
    • For 'Application Website', enter http://mt-hacks.com/twittercommenters.html. For 'Organization', enter MT Hacks.
    • For 'Website' enter http://mt-hacks.com.
    • For 'Application Type' choose 'Browser'.
    • For 'Callback URL' enter the full URL to your comments script followed by '?__mode=login_external&key=Twitter'. Example: http://www.domain.com/cgi-bin/mt/mt-comments.cgi?__mode=login_external&key=Twitter
    • For 'Default Access type' choose 'Read & Write'.
    • Check the box for 'Yes, use Twitter for login'
    • Hit the 'Save' button.
  3. After saving the application, you should now see a screen with a 'Consumer key' and 'Consumer secret'. Copy those to the system plugin Settings (System Overview > Plugins > Twitter Commenters > Settings). and save the plugin settings.
  4. To enable the share comment on Twitter option, add the <mt:TwitterShareCommentOption> tag below the comment text part of your comment form. This will display a checkbox option to people logged in via Twitter OAuth.
  5. Rebuild your entry pages and test it out

As always, feedback is appreciated.

Follow @mthacks on Twitter for updates and other MT and Twitter hacks.

Rate this entry:

  • Currently 4.1/5
  • 1
  • 2
  • 3
  • 4
  • 5
Rating: 4.1/5 (9 votes cast). Powered by the Ajax Rating plugin.

Comments (23)

if you get a "JSON::Any version 1.19 required--this is only version 1.18" error, here is the likely fix:

This is probably happening because you have the Facebooker Commenters plugin installed, which includes JSON::Any 1.18 in its /extlib/ and this is conflicting with v1.19 that is included with Twitter Commenters.

To fix, go to:

/path/to/mt/plugins/FacebookCommenters/extlib/JSON/

and delete Any.pm

This won't break anything, as version 1.19 will be found by MT in the Twitter Commenters plugin.

For those getting the "Can't locate object method default_header" error, stepS to fix:

  • Got to http://search.cpan.org/dist/libwww-perl/.
  • Click the "Download" link.
  • Expand the zip archive
  • Upload the contents of the /lib/ folder to the 'extlib' directory of your MT install
  • Done
  • This won't break anything, as version 1.19 will be found by MT in the Twitter Commenters plugin http://www.chat.t7b.com/123.htm

    Hi Mark, thanks for continuing to put out cool and useful MT plugins.

    I've installed Twitter Commenters 2.1 on my MT 4.25 installation, deleted Any.pm from my Facebook Commenters plugin, and updated my version of libwww-perl. I'm getting the error "Can't call method "permalink" on an undefined value" when trying either the Basic or OAuth methods. Got another simple fix up your sleeves?

    Hi again - I should add two bits of information. The error occurs when clicking "Sign In" (in basic mode) or the "Sign In With Twitter" button (in OAuth mode). When in basic mode, it seems that logins do succeed, despite the message. MT doesn't recognize that I'm signed in initially, but if I click mt login link again, it then tells me I'm already signed in.

    Hans Author Profile Page:

    Thx for the plugin, but I cannot rebuild my postings in MT 4.26

    Hans Author Profile Page:

    Actually I cannot rebuild anything anymore bleh. I saw the twitterplugin updated the database..... How can I correct this or go back? Please urgently reply on this.

    Michael Author Profile Page:

    Hi Mark,

    I'm still getting this error even after installing the /lib/.

    An error occurred. Can't locate object method "default_header" via package "LWP::UserAgent"

    Thanks.

    -Mike

    Thanks for your contenous effort!!

    I have successfully done all the requirements and rebuilts. Once I try to login using twitter, this is the rror I get

    "Can't locate object method "default_header" via package "LWP::UserAgent""

    ANy help?

    TIA!

    I'm getting the same error, despite setting up a Twitter app. Should I just abandon the use of this plugin?

    Sorry I missed your update in the comments... might want to add it to the main post if it's a common problem. However, I downloaded the libwww and installed it, but now i'm getting the error: Unable to load HMAC_SHA1 plugin. Any ideas?

    Jesse, it is indeed mentioned in the main post -- the catch is, you have to read the main post to get! ;) On a serious note, perhaps I should put it in big blod letters or highlight it better, as several people have missed it...

    Regarding the HMAC_SHA1 error, is that the exact perl package referenced? What does the error message say exactly? Seems like this may be a perl module that is installed on many servers by default (based on the fact that you are the first to report this, anyway) and not on others. Installing that perl module should fix it...

    Hi Mark,
    I just tried installing TwitterCommenters on my blog (following the directions and reading all the comments carefully) and I've ended up with the same problem as @Dave Wells has.

    That is to say, login with Twitter fails with:

    "Can't call method "permalink" on an undefined value"

    Any clues or ideas? I noticed that @Dave's site doesn't currently let you login with Twitter either. Should I just turn it off for now?

    Cheers

    Nicolas Author Profile Page:

    I get the same error as @Craig Phillips above. I'm using MT-4.32-fr (pro).

    I already fixed the JSON error caused by Facebook Commenters and the LWP error caused by old version of libwww-perl.

    Byrne Reese:

    I am getting the same error as Jesse: "Unable to load HMAC_SHA1 plugin." I have installed all stated Perl modules - but still, no dice.

    Anonymous:

    I am also getting the same error as Craig and Nicolas. Have you guys gotten it working on your sites yet? If so what was the fix?

    Richard Author Profile Page:

    That was weird. Not sure why it posted that last one as anonymous but it was me with the 'permalink' error.

    Richard Author Profile Page:

    After a bit of research I see that Twitter Commenters doesn't work in MT Pro (http://bgviewsnetwork.com/dev/2009/07/twitter-commenters-21-doesnt-work-in-mt-pro/) Have you had the opportunity to look into it yet? I don't know about other folks but it would certainly be something I would be willing to pay for.

    Awesome idea, I love it!

    Post a comment