Group
Extension

WWW-JSON/lib/WWW/JSON/Role/Authentication/OAuth2.pm

package WWW::JSON::Role::Authentication::OAuth2;
use Moo::Role;
use Safe::Isa;
requires 'authentication';
requires 'ua';

sub _validate_OAuth2 {
    my ( $self, $auth ) = @_;
    die "Must pass a Net::OAuth2::AccessToken object when using "
      . __PACKAGE__
      . " authentication."
      unless $auth->$_isa('Net::OAuth2::AccessToken');
}

sub _auth_OAuth2 {
    my ( $self, $auth, $req ) = @_;
    $req->header( Authorization => 'Bearer ' . $auth->access_token );
}

1;


Powered by Groonga
Maintained by Kenichi Ishigaki <ishigaki@cpan.org>. If you find anything, submit it on GitHub.