Issue with OAuth2 authentication with google spreadsheet

后端 未结 1 796
迷失自我
迷失自我 2020-12-06 21:18

I am using java library for oauth2 authentication for accessing google spreadsheet.

I am using below code for OAuth2 authentication:

credential = new         


        
相关标签:
1条回答
  • 2020-12-06 21:35

    I use:

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

    rather than:

    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.

    0 讨论(0)
提交回复
热议问题