NAME
VK::OAuth - OAuth authorization on your site with VK API
SYNOPSIS
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,
}
);
DESCRIPTION
Use this module for input VK OAuth authorization on your site
METHODS
new
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.
authorize
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.
Options
http://vk.com/developers.php?oid=-1&p=Авторизация_сайтов
Response
Method returns URI object.
request_access_token
my $access = $vk->request_access_token($args->{code});
This method gets access token from VK API.
Options
code - returned in redirected get request from authorize API method.
Response
Method returns HASH object with keys $obj->{user_id}, $obj->{access_token}, $obj->{expires_in}.
request
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.
Options
method (required) - returned in redirected get request from authorize API method; params (not required) - other params; access_token (required) - access token.
Response
Method returns HASH object with requested data.
SUPPORT
Github: https://github.com/Foxcool/VK-OAuth
More information: Authorization - http://vk.com/developers.php?oid=-1&p=Авторизация_сайтов API methods - http://vk.com/developers.php?oid=-1&p=Описание_методов_API And others in http://vk.com/developers.php
AUTHOR
Copyright 2012 Alexander Babenko.
1 POD Error
The following errors were encountered while parsing the POD:
- Around line 139:
Non-ASCII character seen before =encoding in 'http://vk.com/developers.php?oid=-1&p=Авторизация_сайтов'. Assuming UTF-8