OAuth-Consumer

 view release on metacpan or  search on metacpan

README  view on Meta::CPAN

NAME
    OAuth::Consumer - LWP based user agent with OAuth for consumer
    application

SYNOPSIS
    OAuth is a protocol to allow a user to authorize an application to
    access on its behalf ressources on a server without giving its password
    to the application. To achieve this aim OAuth have a fairly complicated
    3-steps authentication mechanism which require to user to go to a
    website to authenticate itself. The authentication response is then
    sent-back by the user itself through a callback mechanism.

    OAuth::Consumer hide away to complexity of this process, including the
    set-up of a callback webserver which can be called by the user browser
    when its authentication is performed.

    This library is oriented toward desktop application, it could possibly
    be used in a web application but I have not tried it (and the LWP setup
    may not be the most appropiate in this case).

    Authenticating your application with OAuth to access some user's
    ressources is a matter of requesting and authorising a *token*. This can
    be done with the following steps:

      use OAuth::Consumer;
  
      my $ua = OAuth::Consumer->new(
                    oauth_consumer_key => 'key',
                    oauth_consumer_secret => 'secret'
                    oauth_request_token_url => 'http://provider/oauth/request_token',
                    oauth_authorize_url => 'http://provider/oauth/authorize',
                    oauth_access_token_url => 'http://provider/oauth/access_token'
            );
  
      my $verifer_url = $ua->get_request_token();
  
      print "You should authentify yourself at this URL: $verifier_url\n";
  
      my ($token, $secret) = $ua->get_access_token()

    At this point, $ua is an OAuth enabled LWP user-agent that you can use
    to access OAuth protected ressources. You should save the $token and
    $secret that you got and, in a later session, you may just do the
    following to gain access to the protected ressources:

      my $ua = OAuth::Consumer->new(
                    oauth_consumer_key => 'key',
                    oauth_consumer_secret => 'secret'
                    oauth_token_=> $token,
                    oauth_token_secret => $secret
            );

DESCRIPTION
    As OAuth::Consumer is a high-level library, this documentation does not
    describe precisely the OAuth protocol. You may find documentation on
    this protocol on these websites:

    <http://markdown.io/https://raw.github.com/Dynalon/Rainy/master/docs/OAU
    TH.md>
    <http://hueniverse.com/oauth/guide/authentication/>
    <http://code.google.com/p/oauthconsumer/wiki/UsingOAuthConsumer>
    <http://tools.ietf.org/html/rfc5849>

CONSTRUCTOR
      my $ua = OAuth::Consumer->new(%args);

    The OAuth::Consumer constructor gives you an LWP::UserAgent object
    (well, strictly speaking this is an LWP::Authen::OAuth object, but you
    should not use directly the method of this module). This object is able
    to authenticate using the OAuth 1.0 or 1.0a protocol (but not OAuth
    2.0).

    You can give to the constructor any LWP::UserAgent arguments. The
    OAuth::Consumer constructor expects some additionnal arguments described
    here:

    *   "oauth_consumer_key" and "oauth_consumer_secret"



( run in 2.222 seconds using v1.01-cache-2.11-cpan-39bf76dae61 )