source: lab.git/twitter/get_oauth.pl @ 35889d4

trunk
Last change on this file since 35889d4 was d006afb, checked in by mitty <mitty@…>, 14 years ago
  • change hash key name

git-svn-id: https://lab.mitty.jp/svn/lab/trunk@47 7d2118f6-f56c-43e7-95a2-4bb3031d96e7

  • Property mode set to 100755
File size: 949 bytes
RevLine 
[c78c702]1#!/usr/bin/env perl
2use strict;
3use warnings;
4use utf8;
5use Net::Twitter;
6
[1680a86]7use YAML::Tiny;
8my $config = (YAML::Tiny->read('config.yml'))->[0];
9
10my $consumer_key = $config->{'consumer_key'};
[d006afb]11my $consumer_key_secret = $config->{'consumer_secret'};
[1680a86]12my $access_token = $config->{'access_token'};
13my $access_token_secret = $config->{'access_token_secret'};
[c78c702]14
15my $nt = Net::Twitter->new(
16  traits          => ['API::REST', 'OAuth'],
17  consumer_key    => $consumer_key,
18  consumer_secret => $consumer_key_secret,
19);
20print 'access this url by bot account : '.$nt->get_authorization_url."\n";
21print 'input verifier PIN : ';
22my $verifier = <STDIN>;
23chomp $verifier;
24
25my $token = $nt->request_token;
26my $token_secret = $nt->request_token_secret;
27
28$nt->request_token($token);
29$nt->request_token_secret($token_secret);
30
31my($at, $ats) = $nt->request_access_token(verifier => $verifier);
32
33print "Access token : ".$at."\n";
34print "Access token secret : ".$ats."\n";
Note: See TracBrowser for help on using the repository browser.