Amon2-Auth-Site-Instagram

 view release on metacpan or  search on metacpan

lib/Amon2/Auth/Site/Instagram.pm  view on Meta::CPAN

    my ($self, $c, $callback) = @_;

    my $res = $self->ua->post($self->access_token_url, +{
        client_id     => $self->client_id,
        client_secret => $self->client_secret,
        grant_type    => 'authorization_code',
        redirect_uri  => $self->redirect_url,
        code          => $c->req->param('code'),
    });
    $res->is_success or do {
        warn $res->decoded_content;
        return $callback->{on_error}->($res->decoded_content);
    };

    $res = decode_json $res->content;

    my @args = ($res->{access_token});
    push @args, $res->{user} if $self->user_info;

    $callback->{on_finished}->(@args);
}



( run in 1.553 second using v1.01-cache-2.11-cpan-6aa56a78535 )