0

I create a google docs using a specific account like the service account with

doc = service.documents().create(doc).execute();

I have to create a google docs for each user of a domain entreptise.tn using the service account name @entreprise.tn.

It's possible ?. Could you please help me solving that ?.

Thanks a lot.

Haydy
  • 5
  • 2
  • Yes, it is indeed possible, you will need to enable [domain wide delegation](https://developers.google.com/drive/api/v3/about-auth#perform_g_suite_domain-wide_delegation_of_authority) to your service account and then iterate over each user of the domain for creating the documents. Does [this other similar Stack Overflow answer](https://stackoverflow.com/a/26243855) solves your question? – Mateo Randwolf Jul 03 '20 at 08:38
  • Hello Sir @MateoRandwolf, thanks a lot for your reply. I know that way using impersonation. I'm asking if there's a way to do that without doing impersonation. It's possible. Big thanks Sir. – Haydy Jul 08 '20 at 08:52
  • Do you mean without the service account? What do you exaclty want to achieve here? Do you want to create files in other user's Drive with the service account but without impersonation? – Mateo Randwolf Jul 09 '20 at 09:50
  • Hello Sir @MateoRandwolf, yes that is it. I'd like to create google drive doc in `another user Drive` ( user account inside the domaine `entreprise.tn` ) using the **service account** `service@entreprise.tn` but without impersonating. It's possible ?. Thanks a lot Sir. – Haydy Jul 13 '20 at 08:30
  • Hi ! I am afraid not, as if you don't impersonate you would just be using the service account with a different role and it couldn't access or create files and folders on behalf of different users. [Check the documentation page](https://cloud.google.com/iam/docs/understanding-service-accounts) to get to know better service accounts. – Mateo Randwolf Jul 20 '20 at 07:33

0 Answers0