Last active
December 24, 2015 12:18
-
-
Save jeffa/6796458 to your computer and use it in GitHub Desktop.
Twitter APIs Client Library for Perl
This file contains hidden or 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 | |
| package LWP::Authen::OAuth2::Dancer; | |
| our $VERSION = '0.1'; | |
| use Dancer ':syntax'; | |
| use Net::Twitter; | |
| use Scalar::Util 'blessed'; | |
| our $nt = Net::Twitter->new( | |
| traits => [qw/API::RESTv1_1/], | |
| consumer_key => '', | |
| consumer_secret => '', | |
| access_token => '', | |
| access_token_secret => '', | |
| ); | |
| get '/' => sub { '<a href="/oauthauthorize">auth</a>' }; | |
| get '/oauthauthorize' => sub { redirect $nt->get_authorization_url( callback => 'http://www.example.com:3000/oauthcallback' ), 303 }; | |
| get '/oauthcallback' => sub { content_type 'text/plain'; to_yaml { params } }; | |
| package main; | |
| use Dancer; | |
| dance; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment