losafishing.blogg.se

Google drive api service account
Google drive api service account











google drive api service account

Import google.oauth2 import service_account from googleapiclient.discovery import build SCOPES = creds = service_account. So for those who just need a working code sample, here it is (note the use of createDelegated): import. It was described here and you should follow all the configuration instructions from there, but the code samples provided there are based on some deprecated packages, so it took me some time to make it work properly combining with the codes from the Drive API tutorial. Otherwise, there's a more elegant way to solve this with the createDelegated() method. The answer of drinkmystery is the right way to go in case your account is private and not a part of Google Workspace (formerly GSuite). Third (dummy enough) question: if OAuth is the only solution, is there a way to obtain/refresh access tokens without doing it manually every time? I looked at OAuth docs and "user interaction/confirmation" is one of the basic thing in the auth flow, so I don't think is possible. I run the example but I didn't understand what the role of that JSON file is: I must log in and give permission anyway, why do I need it? Second (dummy) question: I read docs about creating new OAuth credentials and at the end you obtain some example code and "client-secret" JSON.

google drive api service account

So, first question: is there a way to increase quota for service account? If not, if there a way to use my "normal" account (owner) acting like a service account? Other way: use "standard" OAuth in order to obtain an access token and then use it to make call to Drive API, but access tokens have an expire date and I can't update it manually every time. Because of this (weird) limit I cannot use service account since I have more than 35GB and I need to "share" everything. The only one who can directly access to my Drive account is (or should be) my server, users do their stuff through web app/server.Īfter some search I found server-to-server authorization docs that should be perfect for my purpose BUT, as I can see, service account does not share same Drive space: they have their own and it's not upgradable. I read a lot, but I cannot figure out how to solve this.Ĭontext: I have some files on my Drive account (about 35GB) and a simple web app which let users to log in, see some selected folders/files from my Drive and download them if needed. I've some issues with Google Drive API, service account and authentication.













Google drive api service account