Google Drive API - We're sorry… but your computer or network may be sending automated queries

前端 未结 2 664
一整个雨季
一整个雨季 2021-01-19 17:30

We have a Google Drive Oauth2 App integration. We are using Google Drive API export and get endpoints in order to read data from our customers within their Google Drive Fold

相关标签:
2条回答
  • 2021-01-19 18:05

    We managed to make it work again. We've found this: https://cloud.google.com/blog/products/application-development/upcoming-changes-to-the-google-drive-api-and-google-picker-api

    Google didn't update their Drive API document, so we didn't know about this change.

    Basically we have to switch from the access_token URL parameter to the Authorization Header. This is, to authenticate the API you should use the Header like this:

    "Authorization" : "Bearer ACCESS_TOKEN"
    

    This worked for us.

    Thank you everyone for the help.

    0 讨论(0)
  • 2021-01-19 18:08

    We're having the same problem and after some testing, we've found Google appears to be checking more thoroughly the origin of the tokens.

    According to https://developers.google.com/drive/api/v3/about-auth

    1. If the user approves, then Google gives your application a short-lived access token.
    2. Your application requests user data, attaching the access token to the request.
    3. If Google determines that your request and the token are valid, it returns the requested data.

    We're using a JS file picker and after receiving the object data, when we attempted to $.get it, the file was downloaded correctly but that same URL anywhere else was returning an error.

    UPDATE

    We got it working again with https://developers.google.com/drive/api/v3/manage-downloads:

    To download a file stored on Google Drive, use the files.get method with the ID of the file to download and the alt=media URL parameter. The alt=media URL parameter tells the server that a download of content is being requested.

    0 讨论(0)
提交回复
热议问题