Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drive API Quickstart broken #69

Open
DustinWehr opened this issue Oct 5, 2020 · 3 comments
Open

Drive API Quickstart broken #69

DustinWehr opened this issue Oct 5, 2020 · 3 comments
Assignees

Comments

@DustinWehr
Copy link

The file https://github.com/gsuitedevs/browser-samples/blob/master/drive/quickstart/index.html, which is currently hosted at https://developers.google.com/drive/api/v3/quickstart/js.
Following the instructions exactly:

  • Authorize with my google account works.
  • The call to listFiles gives 401 error. Likewise if I try to call it from the console.

But it works if I remove the apiKey parameter from the gapi.client.init call.

Didn't know if I should make an issue here or at https://github.com/google/google-api-javascript-client.

JavaScript Console Output

cb=gapi.loaded_0:228 GET https://content.googleapis.com/drive/v3/files?pageSize=10&fields=nextPageToken%2C%20files(id%2C%20name)&key=[MY API KEY DELETED] 401
wh @ cb=gapi.loaded_0:228
g @ cb=gapi.loaded_0:228
xh @ cb=gapi.loaded_0:229
(anonymous) @ cb=gapi.loaded_0:229
d @ cb=gapi.loaded_0:186
b @ cb=gapi.loaded_0:181
cb=gapi.loaded_0:191 Uncaught {result: {…}, body: "{↵ "error": {↵  "errors": [↵   {↵    "domain": "gl…e": 401,↵  "message": "Invalid Credentials"↵ }↵}↵", headers: {…}, status: 401, statusText: null}
(anonymous) @ cb=gapi.loaded_0:191
setTimeout (async)
Aj @ cb=gapi.loaded_0:191
(anonymous) @ cb=gapi.loaded_0:204
Nj @ cb=gapi.loaded_0:196
Promise.then (async)
Ij @ cb=gapi.loaded_0:196
_.Mj @ cb=gapi.loaded_0:196
ek @ cb=gapi.loaded_0:203
_.Oj.kh @ cb=gapi.loaded_0:202
(anonymous) @ cb=gapi.loaded_0:197
d @ cb=gapi.loaded_0:976
(anonymous) @ cb=gapi.loaded_0:974
(anonymous) @ cb=gapi.loaded_0:491
v.__cb @ cb=gapi.loaded_0:431
d @ cb=gapi.loaded_0:425
b @ cb=gapi.loaded_0:420

Specifications

  • Browser (Chrome/Internet Explorer/Firefox): Chrome
  • OS (Mac/Linux/Windows): Linux
@pileks
Copy link

pileks commented Nov 17, 2020

I can confirm this behaviour, and removing the API_KEY fixed the problem. Many thanks to @DustinWehr for providing a quick solution, though I'm interested in why we don't need the API_KEY anymore...

@LostBeard
Copy link

LostBeard commented Mar 5, 2023

Trying to use the same example and it does not work unless you remove the 'apiKey' parameter as stated by @DustinWehr.

Thank you @DustinWehr

@jpoehnelt jpoehnelt self-assigned this Mar 6, 2023
jpoehnelt added a commit that referenced this issue Apr 20, 2023
@TheEgghead27
Copy link

+1 to this, found out the hard way with the Picker quickstart.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants