Subject: | Setting refresh_token of Net::Google::DataAPI::Auth::OAuth2 fails |
I have a script that uses Net::Google::Spreadsheets to update a Google Spreadsheet, which used to work a year ago. Now (on a new server with up-to-date CPAN packages), the script fails. I was able to reduce it to these minimum lines:
use Net::Google::DataAPI::Auth::OAuth2;
my $oauth = Net::Google::DataAPI::Auth::OAuth2->new
(client_id => 'xxxx', client_secret => 'xxxx', scope =>
['https://spreadsheets.google.com/feeds/']);
$oauth->refresh_token('asdf');
Runtime error: Can't call method "refresh_token" on an undefined value at .../Net/OAuth2/Profile/WebServer.pm line 105.
I'm using Net::Google::DataAPI 0.2805.
Am I using the refresh_token incorrect?
I got (and saved) the refresh_token by doing:
$oauth->authorize_url();
# ... get code from user from url
print "get code from $url\n";
$oauth->get_access_token($code)
my $rt = $oauth->refresh_token;
# ... save $rt for later use