WWW-Google-Drive

 view release on metacpan or  search on metacpan

lib/WWW/Google/Drive.pm  view on Meta::CPAN

{
    my ($self) = @_;

    LOGDIE "Config JSON file " . $self->secret_json . " not exist!" unless (-f $self->secret_json);

    my $config = Config::JSON->new($self->secret_json);

    my $time = time;

    my $service_acc_id     = $config->get("client_email");
    my $private_key_string = $config->get("private_key");

    my $jwt = JSON::WebToken->encode(
        {
            iss   => $service_acc_id,
            scope => $self->scope,
            aud   => $self->token_uri,
            exp   => $time + 3600,
            iat   => $time,

            # Access files from this users drive/ impersonate user
            prn => $self->user_as,
        },
        $private_key_string,
        'RS256',
        {typ => 'JWT'}
    );

    # Authenticate via post, and get a token
    my $ua       = $self->user_agent;
    my $response = $ua->post(
        $self->token_uri,
        {
            grant_type => encode_entities('urn:ietf:params:oauth:grant-type:jwt-bearer'),

 view all matches for this distribution
 view release on metacpan -  search on metacpan

( run in 0.544 second using v1.00-cache-2.02-grep-82fe00e-cpan-f73e49a70403 )