我正在尝试将文件从桌面上传到Google云端硬盘。我在Google提供的CLIENT_ID
示例中提供了CLIENT_SECRET
和DocumentList.java
。当我作为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)