perl module - Net::Google::Spreadsheets login failing. need to use two-legged OAuth2 -


i have application uses net::google::spreadsheets. began fail authentication errors earlier week. understanding google has deprecated authentication methods, , use oauth2.

my application runs on headless server, cannot use three-legged oauth2 solution shown in net::google::authsub login failed new google drive version

i need use two-legged authentication service account. put code build jwt, , obtain access_token (as detailed in google developer documentation).

what need assistance method need use net::google::spreadsheets make use of access_token, or method two-legged oauth2 works module.

if have managed create access_token, should able right format net::google::spreadsheets using create new net::oauth2::accesstoken object, , proceeding more or less in example linked in other thread:

use net::google::spreadsheets; use net::google::dataapi::auth::oauth2; use net::oauth2::accesstoken;  $oauth2 = net::google::dataapi::auth::oauth2->new(     client_id => 'my_client_id.apps.googleusercontent.com',     client_secret => 'my secret',     scope => ['http://spreadsheets.google.com/feeds/'],     ); $access_token = 'token generate somehow';  $token = net::oauth2::accesstoken->new(access_token => $access_token,                   profile => $oauth2->oauth2_webserver,                   token_type => 'bearer',                   ); $oauth2->access_token($token);  $service = net::google::spreadsheets->new(auth => $oauth2); 

and can use service there. if want repeatedly use same token, you'll need refresh_token , include that, setting auto_refresh, if you're generating new 1 each time, should work.


Comments

Popular posts from this blog

Java 3D LWJGL collision -

spring - SubProtocolWebSocketHandler - No handlers -

methods - python can't use function in submodule -