سؤال

I'm trying to perform Google Drive API calls using "Service Accounts" authorization.

I'm calling the API, but files.list returns me empty set, meanwhile the drive is not empty. I guess I should specify prn field as well in order to perform call on behalf of the concrete user (I don't really get who is it called for when prn is not specified). The problem is that when I specify prn authorization returns me access_denied error.

{
  "error" : "access_denied"
}

Documentation says that I should enable client API access from control panel http://support.google.com/a/bin/answer.py?hl=en&answer=162106

Here is what I've done, but this doesn't help much, it still gives me access_denied.

'Authorized API clients' screenshot

What's wrong here?

هل كانت مفيدة؟

المحلول

You are almost right. You indeed need to authorize your app to access domain's Drive. To do this you have to associate the scopes you chose with the service account id that you can find in your API console. This association is made in the administrative panel of your domain, of whoch you posted a screenshot.

I think you got that, but dont forget to use the service account email in your Oauth2 request.

FYI, if you dont specify prn , you access your application's drive, which cant be accessed via the Web UI

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top