madeon (madeon) wrote in changelog,
madeon
madeon
changelog

[ljcom] r12623: LJSV-2400: Can't login with or connect t...

Committer: sbelyaev
LJSV-2400: Can't login with or connect to VKontakte
U   trunk/cgi-bin/LJ/Client/Vkontakte.pm
U   trunk/htdocs/identity/callback-vkontakte.bml
U   trunk/htdocs/manage/settings/vkontakte.bml
Modified: trunk/cgi-bin/LJ/Client/Vkontakte.pm
===================================================================
--- trunk/cgi-bin/LJ/Client/Vkontakte.pm	2012-09-07 08:56:12 UTC (rev 12622)
+++ trunk/cgi-bin/LJ/Client/Vkontakte.pm	2012-09-07 10:41:35 UTC (rev 12623)
@@ -52,6 +52,7 @@
 
     $opts->{'client_id'}        ||= $LJ::VKONTAKTE_CONF->{'client_id'};
     $opts->{'client_secret'}    ||= $LJ::VKONTAKTE_CONF->{'client_secret'};
+    $opts->{'redirect_uri'}     ||= $opts->{'redirect_uri'};
 
     my $uri = URI->new('https://api.vk.com/oauth/token');
     $uri->query_form(%$opts);
@@ -74,7 +75,7 @@
     if ( $params_returned->{'error'} ) {
         warn 'vkontakte connectivity error: '
            . $params_returned->{'error'} . ' / '
-           . $params_returned->{'error_description'};
+           . $params_returned->{'info'};
 
         die 'vkontakte connectivity error';
     }

Modified: trunk/htdocs/identity/callback-vkontakte.bml
===================================================================
--- trunk/htdocs/identity/callback-vkontakte.bml	2012-09-07 08:56:12 UTC (rev 12622)
+++ trunk/htdocs/identity/callback-vkontakte.bml	2012-09-07 10:41:35 UTC (rev 12623)
@@ -36,9 +36,13 @@
         return LJ::Request->redirect($returl_fail);
     }
 
+    # last request redirect uri
+    my $redirect_uri = "$LJ::SITEROOT/identity/callback-vkontakte.bml?" .
+                       'forwhat=' . LJ::eurl($forwhat);
+
     my $token_info 
-        = LJ::Client::Vkontakte->fetch_access_token( { 'code' => $code } );
-
+        = LJ::Client::Vkontakte->fetch_access_token( { 'code'         => $code,
+                                                       'redirect_uri' => $redirect_uri, } );
     my $created;
 
     my $u = LJ::User::load_identity_user( 'V', $token_info->{'user_id'},

Modified: trunk/htdocs/manage/settings/vkontakte.bml
===================================================================
--- trunk/htdocs/manage/settings/vkontakte.bml	2012-09-07 08:56:12 UTC (rev 12622)
+++ trunk/htdocs/manage/settings/vkontakte.bml	2012-09-07 10:41:35 UTC (rev 12623)
@@ -54,8 +54,10 @@
         }
 
         my $params_returned = LJ::Client::Vkontakte->fetch_access_token({
-            'code' => $vk_code,
+            'code'          => $vk_code,
+            'redirect_uri'  => $LJ::SITEROOT . "/manage/settings/vkontakte.bml?act=$act",
         });
+
         my $vk_token = $params_returned->{'access_token'};
         my $vkuid = $params_returned->{'user_id'};
 

Tags: bml, ljcom, madeon, pm, sbelyaev
Subscribe
  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 0 comments