Net::Google::AuthSub login failed with new Google Drive version

后端 未结 3 2311
说谎
说谎 2020-12-09 06:45

This code in Perl was working for years and now my Spreadsheets logins failed, when I logged into my account I noticed switch to a new Drive version. Probably some authentic

3条回答
  •  自闭症患者
    2020-12-09 07:00

    Thanks for this - very helpful. One addition is that the code in the original poster's answer will generate a token that expires in an hour. If you want to keep using it, you need to be sure to formulate the initial request so that it generates not only the access token, but also the refresh token. To get this, change the initial

    my $url = $oauth2->authorize_url();
    

    to

    my $url = $oauth2->authorize_url(access_type => 'offline',
                                     approval_prompt => 'force');
    

    Then the returned token will have the necessary refresh_token included.

提交回复
热议问题