You need to authorize and authenticate your requests on the behalf of the user, a key and your client ID will not be enough to access user's non-public document. Auth for PHP is explained on https://developers.google.com/drive/quickstart-php
I've now spent hours making this work and I'm running out of documentation to read on how to get such a simple process to work correctly. Here's my ideal situation.
I have Google Drive API enabled and running. I have Google Drive SDK enabled and appears to be working properly. I've read elsewhere that this could be a file permissions error, but I have no direction on how to correct this if it even is the problem.
For the record, I also had to do a dropbox integration, and entire integration from start to finish was less than 30 minutes.
Just in case I'm missing something with my api keys (there are way too many), for the picker, I need to the following from the Google Cloud interface. The .setDeveloperKey which is the Browser Key API Key, the .setAppId is the Oauth 2.0 client id.
When I setup the php library and am building up the client, $client->setClientId() is my Oauth 2.0 client id and $client->setDeveloperKey() is my Server Key API Key correct?
2条回答 默认 最新
- 已采纳 dongtui4038 2013-10-02 20:08点赞 评论 复制链接分享
- duanliaoyin3171 2014-09-04 17:18
In my case it turned out to be a problem with scopes. When I used
'https://www.googleapis.com/auth/drive.file'I got 404 for any file. However when I used
'https://www.googleapis.com/auth/drive.readonly', I can get the meta data and exportLink for downloading file contents, etc.
Per https://developers.google.com/drive/web/scopes, the 'file' scope gives access to files created or opened by the app, while the 'readonly' scope does not have this constraint.点赞 评论 复制链接分享