Created
December 7, 2012 04:48
-
-
Save MacoTasu/4230822 to your computer and use it in GitHub Desktop.
redirect実装したい
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
ackage Actlog::Controller::Login; | |
use Ark 'Controller'; | |
use Actlog::Models; | |
use Try::Tiny; | |
use JSON::Types; | |
use Facebook::Graph; | |
use CGI; | |
sub index : Path{ | |
my ($self,$c) = @_; | |
}; | |
my $fb = Facebook::Graph->new( | |
app_id => '394680190607371', | |
secret => 'ac41be120cb3cdf08c43817f2c1fa118', | |
postback => 'http://localhost:5000/article', | |
); | |
sub facebook : Local{ | |
my ($self, $c) = @_; | |
my $uri = $fb->authorize->extend_permissions(qw//)->uri_as_string; | |
return $c->res->CGI::redirect($uri); ##ここの書き方がイマイチ... | |
#return $c->res->redirect($c->res->$uri('/')); | |
}; | |
sub postback : Local{ | |
my ( $self, $c ) = @_; | |
$fb->request_access_token( $self->param('code') ); | |
my $me = $fb->fetch('me'); | |
$self->render( 'me', me => $me ); | |
} | |
__PACKAGE__->meta->make_immutable; | |
1; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment