#!/usr/bin/perl
use 5.10.0;
use strict;
use warnings;
use autodie;
use Net::Twitter;
use Exobrain::Config;
# PODNAME: twitter-auth
# ABSTRACT: OAuth with twitter from the command-line
# TODO: Make a generalised exobrain config sript that calls this.
my $config = Exobrain::Config->new;
my $nt = Net::Twitter->new(
traits => ['API::RESTv1_1', 'OAuth'],
consumer_key => $config->{Twitter}{consumer_key},
consumer_secret => $config->{Twitter}{consumer_secret},
ssl => 1,
);
say $nt->get_authorization_url;
my $pin = <STDIN>; # wait for input
chomp $pin;
my($access_token, $access_token_secret, $user_id, $screen_name) = $nt->request_access_token(verifier => $pin);
say "Token: $access_token";
say "Secret: $access_token_secret";
__END__
=pod
=head1 NAME
twitter-auth - OAuth with twitter from the command-line
=head1 VERSION
version 0.06
=head1 AUTHOR
Paul Fenwick <pjf@cpan.org>
=head1 COPYRIGHT AND LICENSE
This software is copyright (c) 2014 by Paul Fenwick.
This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.
=cut