provide easy way to use oauth for mt plugins
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.





A Movable Type plugin helps other plugins using OAuth. This plugin can manage consumer credentials, do and manage handshake with service provider for each user, access to protected resources and it's fallback.


For MT User

At first, MT Administrator, maybe who had installed a plugin which using this framework, should do register your MT instance as New Application to the OAuth Service Provider.

  • Go to System > Settings > OAuth Servers

  • click "regist this MT to SERVICEPROVIDER"

  • Enter information about your MT Install as application

  • save them, then look for consumer key and consumer secret in the service provider site

  • Copy consumer key and consumer secret and paste them to MT setting screen

  • save

OK, now your MT install can handshake with the service provider. after that, let's see the plugin's instruction.

For Plugin writter

## Add service provider information to config.yaml of your plugin.

        label: Example Provider

## And you perl code..

use MT::OAuth;

sub post {
    my ($app) = shift;
    my (%forward) = @_;
    ## get parameters at retry...
    my $text = $forward{post}{text} || $app->param('text');
    my $author = $app->user or die;
    my $client = MT::OAuth->client('example_provider');
    return $server->access(
        author_id => $author->id,
               end_point => '',
        post => {
            status => $text,
        retry => 1,  ## request to MT to go back to this method after handshaking.
        callback => sub {
            ## when accessing to the resource is finished, this will be called.
            return $app->return_to_dashboard;

## this is all.
## if the author hasn't yet authorized, MT will automatically do handshake, and 
## after handshaked, back to the method again.

Run with MT4.x

Some of perl modules bundled with MT4.x is too old to run this plugin. here is steps to run OAuthFramework plugin with MT4.x.

1) remove these files and directories from your ( MT4_HOME )/extlib directory. * HTTP/ * LWP/ *

2) ( if you still got errors about LWP::*** or HTTP::***, ) install LWP to you system via CPAN or your system's package manager.