Google云端硬盘 - 401错误

时间:2016-07-12 08:48:06

标签: google-drive-api

我一直在尝试在这里进行教程https://developers.google.com/drive/v3/web/quickstart/java并且我一直收到此错误:

Exception in thread "main" com.google.api.client.auth.oauth2.TokenResponseException: 401 Unauthorized
at com.google.api.client.auth.oauth2.TokenResponseException.from(TokenResponseException.java:105)
at com.google.api.client.auth.oauth2.TokenRequest.executeUnparsed(TokenRequest.java:287)
at com.google.api.client.auth.oauth2.TokenRequest.execute(TokenRequest.java:307)

错误发生在

FileList result = service.files().list()
         .setPageSize(10)
         .setFields("nextPageToken, files(id, name)")
         .execute();

1 个答案:

答案 0 :(得分:0)

您似乎可能遗漏".credentials/drive-java-quickstart.json"。正如this thread TokenResponseException: 401 Unauthorized中所述,显示何时不包含该内容。