Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting Server Rejected error when upload using Google Picker, Oauth2

We are trying to use google.picker to have our users upload files to our drive account (i.e., the user is not required to have a Google account to upload).

We're trying to use regular Google accounts as application-owned accounts and got our AUTH_TOKEN using OAuth2 and set it using .setOAuthToken(AUTH_TOKEN) . We followed everything described in the docs.

However, when uploading, we got a Server Rejected error. The call to https://docs.google.com/upload/resumableupload?authuser=undefined returned:

{"errorMessage":{"reason":"REQUEST_REJECTED","additionalInfo":{"uploader_service.GoogleRupioAdditionalInfo":{"completionInfo":{"status":"REJECTED"},"requestRejectedInfo":{"reasonDescription":"agent_rejected"}}},"upload_id":"AEnB2Ur64Gb0JDCk_8mg5EhpdcaqL82wBQHumHjcGvDqYibtksmUzhfhBolsmBFzRuvQPRyi43SYfactJZvIWYrQ6xAqzu3L9g"}}

We know we cannot use service accounts since the picker doesn't support it.

Do we miss something in getting the AUTH_TOKEN? Do we need to something in the console?

like image 760
onerobertreyes Avatar asked Jan 03 '13 11:01

onerobertreyes


People also ask

Why does Google say server rejected?

Unless the servers are to be blamed, more often than not, the server rejected error in Google Classroom is caused due to insufficient free storage in Google Drive. It can also be caused if your phone isn't connected to the WiFi and the Transfer files only over Wi-Fi setting is disabled.


1 Answers

Give us a little more code, or check the call to gapi.auth.authorize()

  1. Check that you are using the correct scope to obtain the OAuth token.
    • Scope should be https://www.googleapis.com/auth/drive
  2. Double-Check the scope declaration:
    • https://developers.google.com/accounts/docs/OAuth2Login#sendauthrequest
  3. Check the call to gapi.auth.authorize()

    window.gapi.auth.authorize( {      'client_id': clientId,      'scope': scope,      'immediate': false }, handleAuthResult); 

    from: https://developers.google.com/picker/docs/#hiworld

Without an actual code sample, it is very difficult to say exactly what is going on. Most likely it is the auth token colection. However, it may also be something as simple as not defining a google User (clientID) which in turn impacts the gapi.auth.authorize() call.

like image 194
Tony Chiboucas Avatar answered Sep 22 '22 08:09

Tony Chiboucas