Permalink
Browse files

request access token

  • Loading branch information...
monken committed Jul 9, 2011
1 parent 6bb2080 commit 46335e14ad324cd0ec8a0ff15fabd4116edfbb6b
Showing with 10 additions and 3 deletions.
  1. +10 −3 lib/MetaCPAN/Web/Controller/Login.pm
@@ -5,12 +5,19 @@ use namespace::autoclean;
BEGIN { extends 'MetaCPAN::Web::Controller' }
-sub index :Path {
+sub index : Path {
my ( $self, $c ) = @_;
my $code = $c->req->parameters->{code};
return $c->detach('/not_found') unless ($code);
- my $data = $c->model('API')->request("/login/validate?code=$code")->recv;
- $c->req->session->set( msid => $data->{sid} );
+ my $data
+ = $c->model('API')
+ ->request(
+ "/oauth2/access_token?client_id=metacpan&client_secret=ClearAirTurbulence&code=$code"
+ )->recv;
+ use Data::Printer;
+ p($data);
+ $c->req->session->set( token => $data->{access_token} );
+ $c->authenticate( { token => $data->{access_token} } );
$c->res->redirect('/');
}

0 comments on commit 46335e1

Please sign in to comment.