Last active
December 23, 2015 09:39
-
-
Save jeffa/6616207 to your computer and use it in GitHub Desktop.
Google 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 LWP::Authen::OAuth2; | |
| our $oauth2 = LWP::Authen::OAuth2->new( | |
| client_id => '', | |
| client_secret => '', | |
| service_provider => 'Google', | |
| redirect_uri => 'http://www.example.com/oauth2callback', | |
| scope => 'https://www.googleapis.com/auth/calendar', | |
| ); | |
| get '/' => sub { '<a href="/oauth2authorize">auth</a>' }; | |
| get '/oauth2authorize' => sub { redirect $oauth2->authorization_url, 303 }; | |
| get '/oauth2callback' => 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