且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

使用Google电子表格进行OAuth2身份验证时出现问题

更新时间:2023-12-01 12:45:40

我使用:

spreadsheetService = new SpreadsheetService("cellmaster.com.au-v0.2");  
spreadsheetService.setHeader("Authorization", "Bearer " + accessToken);

而不是:

spreadsheetService = new SpreadsheetService("cellmaster.com.au-v0.2");  
spreadsheetService.setOAuth2Credentials(credential);

我还必须为刷新令牌添加代码。随着访问令牌即将到期。但刷新令牌可以正常运行。

also I had to add code for the refresh token. As the access token soon expires. But the refresh token works as you would expect.