NAME

OAuth::Simple - Simple OAuth authorization on your site

SYNOPSIS

my $oauth = OAuth::Simple->new(
    app_id     => 'YOUR APP ID',
    secret     => 'YOUR APP SECRET',
    postback   => 'POSTBACK URL',
);
my $url = $oauth->authorize( 'https://www.facebook.com/dialog/oauth', {scope => 'email'} );
# Your web app redirect method.
$self->redirect($url);
# Get access_token.
my $access = $oauth->request_access_token( 'https://graph.facebook.com/oauth/access_token', $args->{code} );
# Get user profile data.
my $profile_data = $oauth->request(
    'https://graph.facebook.com/me',
    $access_token,
);  

DESCRIPTION

Use this module for input VK OAuth authorization on your site

METHODS

new

my $oauth = OAuth::Simple->new(
    app_id     => 'YOUR APP ID',
    secret     => 'YOUR APP SECRET',
    postback   => 'POSTBACK URL',
);

The new constructor lets you create a new OAuth::Simple object.

authorize

my $url = $oauth->authorize( $authorize_server_url, {option => 'value'} );
# Your web app redirect method.
$self->redirect($url);

This method returns a URL, for which you want to redirect the user.

Options

See information about options on your OAuth server.

Response

Method returns URI object.

request_access_token

my $access = $oauth->request_access_token( $server_url, $args->{code} );

This method gets access token from OAuth server.

Options

code - returned in redirected get request from authorize API method.

Response

Method returns HASH object.

request_data

  my $profile_data = $oauth->request(
      $api_method_url,
      $access_token,
      {
	    option => 'value',
      }
  );

This method sends requests to OAuth server.

Options

url (required) - api method url; params (not required) - other params; access_token (required) - access token.

Response

Method returns HASH object with requested data.

prepare_http_request

Returns HTTP::Request object.

SUPPORT

Github: https://github.com/Foxcool/OAuth-Simple

Bugs & Issues: https://github.com/Foxcool/OAuth-Simple/issues

AUTHOR

Copyright 2012 Alexander Babenko.