1
-----------------------------這裏收到32長度密鑰auth_token REST auth期間出錯.getSession調用: params = api_key:-------------- auth_token:----------------------- -------- call_id:------------.----- [像十進制值 格式:JSON 方法:facebook.auth.getSession v:1.0 響應= { 「ERROR_CODE」:100, 「ERROR_MSG」: 「無效參數」, 「request_args」:[WWW:Facebook:Api認證令牌
{"key":"api_key","value":"---------------"},
{"key":"auth_token","value":"----------------------"},
{"key":"call_id","value":"-------------------"},
{"key":"format","value":"JSON"},
{"key":"method","value":"facebook.auth.getSession"},
{"key":"v","value":"1.0"},
{"key":"sig","value":"f253b75e337776756a1fba88f085c269"}]}
WWW::Facebook::API=HASH(0xa203ce8)
我需要轉換收到的auth_token該怎麼做?我怎樣才能驗證收到一個正確的密鑰或沒有。
#!/usr/bin/perl -w
use strict;
use warnings;
use CGI;
use WWW::Facebook::API;
use WWW::Facebook::API::Auth;
use HTTP::Request;
use LWP;
my $TMP = $ENV{HOME}.'/tmp';
my $facebook_api = '--------';
my $facebook_secret = '-------';
my $facebook_clientid = '--------';
my $gmail_user = '-------';
my $gmail_password = '--------';
my $client = WWW::Facebook::API->new(
desktop => 1,
api_version => '1.0',
api_key => $facebook_api,
secret => $facebook_secret,
throw_errors => 1,
);
$client->app_id($facebook_clientid);
local $SIG{INT} = sub {
print "Logging out of Facebookn";
my $r = $client->auth->logout;
exit(1);
};
my $token = $client->auth->create_token;
print "$token \n";
$client->auth->get_session($token);
print "$client \n";