Created
September 11, 2012 05:07
-
-
Save dameninngenn/3696085 to your computer and use it in GitHub Desktop.
auth_twitter
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
use strict; | |
use warnings; | |
use Net::Twitter::Lite; | |
use Term::UI; | |
use Term::ReadLine; | |
my $term = Term::ReadLine->new('Tw'); | |
my $consumer_key = $term->get_reply( | |
prompt => 'Enter Consumer Key: ', | |
); | |
my $consumer_secret = $term->get_reply( | |
prompt => 'Enter Consumer Secret: ', | |
); | |
my $tw = Net::Twitter::Lite->new( | |
consumer_key => $consumer_key, | |
consumer_secret => $consumer_secret, | |
legacy_lists_api => 0, | |
); | |
my $pin = $term->get_reply( | |
print_me => sprintf('%s', $tw->get_authorization_url), | |
prompt => 'Enter PIN: ', | |
); | |
my ($token, $token_secret) = $tw->request_access_token(verifier => $pin); | |
print sprintf("Token: %s\n", $token); | |
print sprintf("Token Secret: %s\n", $token_secret); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment