1

我正在尝试将文件从我的桌面上传到谷歌驱动器。我在 Google 提供的示例中给出了CLIENT_IDand 。当我作为 java 应用程序运行时,出现以下错误:CLIENT_SECRETDocumentList.java

return service.insert(buildUrl(URL_DEFAULT + URL_DOCLIST_FEED), newDocument);

代码:

oauthParameters.setOAuthConsumerKey(CLIENT_ID);
oauthParameters.setOAuthConsumerSecret(CLIENT_SECRET);    
oauthParameters.setScope("https://docs.google.com/feeds/");
DocsService service = new DocsService("wise");

错误:

com.google.gdata.util.AuthenticationException: Authorization required
    at com.google.gdata.client.http.HttpGDataRequest.handleErrorResponse(HttpGDataRequest.java:608)
    at com.google.gdata.client.http.GoogleGDataRequest.handleErrorResponse(GoogleGDataRequest.java:564)
    at com.google.gdata.client.http.HttpGDataRequest.checkResponse(HttpGDataRequest.java:560)
    at com.google.gdata.client.http.HttpGDataRequest.execute(HttpGDataRequest.java:538)
    at com.google.gdata.client.http.GoogleGDataRequest.execute(GoogleGDataRequest.java:536)
    at com.google.gdata.client.media.MediaService.insert(MediaService.java:400)
    at com.DocumentList.uploadFile(DocumentList.java:538)
    at com.DocumentList.login(DocumentList.java:230)
    at com.DocumentList.main(DocumentList.java:546)
4

0 回答 0