Skip to content

support JSON Web Token#7

Open
shogo82148 wants to merge 4 commits into
lopnor:masterfrom
shogo82148:oauth2-signed-jwt
Open

support JSON Web Token#7
shogo82148 wants to merge 4 commits into
lopnor:masterfrom
shogo82148:oauth2-signed-jwt

Conversation

@shogo82148

Copy link
Copy Markdown

Hello
I want to use Service Account for authorization but Net::Google::DataAPI seems not to support it now.
So, I implemented Using OAuth 2.0 for Server to Server Applications.

Net::Google::DataAPI::Auth::OAuth2::SignedJWT uses private key instead of password for authorization.

use Net::Google::DataAPI::Auth::OAuth2::SignedJWT;
my $oauth2 = Net::Google::DataAPI::Auth::OAuth2->new(
     private_key => <<'__KEY__',
-----BEGIN PRIVATE KEY-----
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
-----END PRIVATE KEY-----
__KEY__
     service_account => 'xxxxxxx@developer.gserviceaccount.com',
     scope => ['http://spreadsheets.google.com/feeds/'],
 );
$oauth2->get_access_token or die;
my $client = Net::Google::Spreadsheets->new(auth => $oauth2);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant