VK::OAuth - OAuth authorization on your site with VK API
my $vk = VK::OAuth->new( app_id => 'YOUR APP ID', secret => 'YOUR APP SECRET', postback => 'POSTBACK URL', ); my $url = $vk->authorize( {option => 'value'} ); # Your web app redirect method. $self->redirect($url); # Get access_token. my $access = $vk->request_access_token($args->{code}); # Get user profile data. my $profile_data = $vk->request( 'users.get', $access_token, { fields => "uid,first_name,last_name,nickname,screen_name,sex,bdate,city,country", uids => $user_id, } );
Use this module for input VK OAuth authorization on your site
my $vk = VK::OAuth->new( app_id => 'YOUR APP ID', secret => 'YOUR APP SECRET', postback => 'POSTBACK URL', );
The new constructor lets you create a new VK::OAuth object.
new
my $url = $vk->authorize( {option => 'value'} ); # Your web app redirect method. $self->redirect($url);
This method returns a URL, for which you want to redirect the user.
See information about options on http://vk.com/developers.php
Method returns URI object.
my $access = $vk->request_access_token($args->{code});
This method gets access token from VK API.
code - returned in redirected get request from authorize API method.
Method returns HASH object with keys $obj->{user_id}, $obj->{access_token}, $obj->{expires_in}.
my $profile_data = $vk->request( 'users.get', $access_token, { fields => "uid,first_name,last_name,nickname,screen_name,sex,bdate,city,country", uids => $user_id, } );
This method sends requests to VK API.
method (required) - returned in redirected get request from authorize API method; params (not required) - other params; access_token (required) - access token.
Method returns HASH object with requested data.
Github: https://github.com/Foxcool/VK-OAuth
More information: http://vk.com/developers.php
Copyright 2012 Alexander Babenko.
To install VK::OAuth, copy and paste the appropriate command in to your terminal.
cpanm
cpanm VK::OAuth
CPAN shell
perl -MCPAN -e shell install VK::OAuth
For more information on module installation, please visit the detailed CPAN module installation guide.