Dancer-Plugin-Auth-Github
view release on metacpan or search on metacpan
lib/Dancer/Plugin/Auth/Github.pm view on Meta::CPAN
my $resp = $browser->post($github_post_url,
[
client_id => $client_id,
client_secret => $client_secret,
code => $code,
state => $state_received
]);
die "error while fetching: ", $resp->status_line
unless $resp->is_success;
my %querystr = parse_query_str($resp->decoded_content);
my $acc = $querystr{access_token};
if($acc) {
my $jresp = $browser->get("https://api.github.com/user?access_token=$acc");
my $json = decode_json($jresp->decoded_content);
session 'github_user' => $json;
session 'github_access_token' => $acc;
#session 'logged_in' => true;
redirect $github_auth_success;
return;
}
}
redirect $github_auth_failed;
};
( run in 0.333 second using v1.01-cache-2.11-cpan-a9ef4e587e4 )