401 Unauthorized
[DEBUG Net::OAuth] Request to_url: http://api.t.sina.com.cn/oauth/request_token?oauth_consumer_key=1438635265&oauth_nonce=1434579439&oauth_signature=c9woVbzjj6bFXWikhduY%2FwMeJG0%3D&oauth_signature_method=HMAC-SHA1&oauth_timestamp=1282380286&oauth_version=1.0
[DEBUG Net::OAuth] Got Request Token: ec5165fe718d1869f2edaca3bbad55fa
[DEBUG Net::OAuth] Got Request Token Secret: b70a38b114d841b08d41258c4cc55ca5
[DEBUG Net::OAuth] STEP 2: SINA OAUTH TOKEN RESPONSE
[DEBUG Net::OAuth] RESPONSE: oauth_token=ec5165fe718d1869f2edaca3bbad55fa&oauth_token_secret=b70a38b114d841b08d41258c4cc55ca5
[DEBUG Net::OAuth] STEP 3: REQUEST SINA AUTHORIZATION FOR THIS APP
[DEBUG Net::OAuth] URL : http://api.t.sina.com.cn/oauth/authorize?oauth_token=ec5165fe718d1869f2edaca3bbad55fa&oauth_callback=http%3A%2F%2Fwww.imx.net%2Foauth_sina_call.mpl
[DEBUG Net::OAuth] STEP 4: REQUEST SINA ACCESS TOKEN FOR THIS APP
[DEBUG Net::OAuth] URL: http://api.t.sina.com.cn/oauth/access_token?oauth_consumer_key=1438635265&oauth_nonce=3970420988&oauth_signature=6uaB8lKVQB15b9Yc%2FOO1fne%2FdAU%3D&oauth_signature_method=HMAC-SHA1&oauth_timestamp=1282380340&oauth_token=ec5165fe718d1869f2edaca3bbad55fa&oauth_version=1.0&oauth_verifier=713290
eval { require LWP::UserAgent } or $m->error("LWP::UserAgent module not available.$return_code");
eval { require Net::SSL } or $m->error("Net::SSL module not available.$return_code");
eval { require Net::OAuth } or $m->error("Net::OAuth module not available.$return_code");
use Net::OAuth;
use Net::OAuth::Request;
use Net::OAuth::RequestTokenRequest;
use Net::OAuth::AccessTokenRequest;
use Net::OAuth::ProtectedResourceRequest;
#$Net::OAuth::PROTOCOL_VERSION = Net::OAuth::PROTOCOL_VERSION_1_0A;
my $ua = LWP::UserAgent->new;
#use CGI;
# my $q = new CGI;
#sub { imxMain::MP ? $m->{apr}->param($_[0]) : $m->{cgi}->param($_[0]) }
my $token = $cookies->{"token"};
my $token_secret = $cookies->{"token_secret"};
my $response_token = $m->paramStr("oauth_token");
my $verifyer = $m->paramStr("oauth_verifier");
my $request = Net::OAuth::AccessTokenRequest->new(
consumer_key => '*',
consumer_secret => '*',
request_url => 'http://api.t.sina.com.cn/oauth/access_token',
request_method => 'GET',
signature_method => 'HMAC-SHA1',
timestamp => time,
nonce => int(rand(2 ** 32)),
token => $token,
token_secret => $token_secret,
);
$request->sign;
if (!$request->verify) {
die "Signature verification failed";
}
else {
my $res = $ua->post($request_url); # Post message to the Service Provider
if ($res->is_success) {
print STDERR "[DEBUG Net::OAuth] STEP 5: SINA ACCESS TOKEN RESPONSE\n";
print STDERR "[DEBUG Net::OAuth]\tRESPONSE : " . $res->content . "\n";
print $res->content;
}
print $res->status_line;
}
您收到此邮件是因为您订阅了 Google 网上论坛的"PerlChina Mongers 讨论组"论坛。
要向此网上论坛发帖,请发送电子邮件至 perlchina@googlegroups.com。
要取消订阅此网上论坛,请发送电子邮件至 perlchina+unsubscribe@googlegroups.com。
若有更多问题,请通过 http://groups.google.com/group/perlchina?hl=zh-CN 访问此网上论坛。
没有评论:
发表评论