Google Drive API through Google App Engine

前端 未结 5 1470
长情又很酷
长情又很酷 2021-01-05 08:13

I\'m trying to use the Google Drive API through the App Identity interface provided with Google App Engine. This basically allows my web application to communicate with Goog

5条回答
  •  萌比男神i
    2021-01-05 08:29

    AFAICT you should be using Bearer in the Authorization header.

    Probably what's happening is, Drive API doesn't recognize the service account (because of the wrong header?) and thus taking it as an anonymous request since no key parameter wasn't provided either (see common query params).

    Try this:

    connection.addRequestProperty("Authorization", "Bearer " + accessToken.getAccessToken());
    

    Or you could try adding the token as access_token query param.

提交回复
热议问题