bez
bez

Reputation: 11

Intermittent "The API developer key is invalid" error

We have a live application that gives the "The API developer key is invalid" intermittently.

The normal flow:

  1. User clicks "Import from Google Drive"
  2. Gets an OAuth screen
  3. Selects a user (if there are more than one)
  4. Gets prompted with the Google Picker
  5. Picks a file
  6. File gets imported

But for some users, after selecting a user in point 3 (or automatically if there is only one user) the Picker dialog doesn't open, but gets prompted with an "In order to select an item from your online storage, please sign in" message on black background with red Sign in button on it. (see screenshot)

Sign in screen

Then after clicking "Sign in", the user receives the "The API developer key is invalid" error message, and the flow stops. (see screenshot again)

API key error screen

For the majority of the users everything works fine. Seems to be a per user issue, because we have an affected user that has multiple gmail addresses signed in into Chrome, and this issue happens with one email address, but doesn't happen with the other.

Any ideas?

Upvotes: 0

Views: 1238

Answers (1)

bez
bez

Reputation: 11

After a long search, I found a workaround. I had to replace the gapi.auth2.init and gapi.auth2. signIn calls with gapi.auth2.authorize and it started to work for those affected users too. Submitted a report to Google about it, but at the time of writing, there was not much reply: https://github.com/google/google-api-javascript-client/issues/613

Upvotes: 1

Related Questions