Chirag
Chirag

Reputation: 475

Not able to access google drive Files with service account

I am working on Upload file in Google drive with Service Account, I am able to insert file in Google Drive, but I am not able to view that file in Google Drive.

I am create [email protected]. create a service account with [email protected]. with the P12 certificate and Service Client Email id, I am able to insert file in drive. But not able to seen that file in [email protected]'s Google drive. While fatch the list of files from application it will show 5 files but in my [email protected]'s drive contains only 1 file.

Question

  1. How can I see my uploaded file on google drive with service account
  2. File is successfully uploaded then how can I see the files in [email protected]'s Google Drive

Upvotes: 1

Views: 1924

Answers (2)

Abhishek
Abhishek

Reputation: 93

You need to give permission to that file for accessing it: https://developers.google.com/drive/api/v3/reference/permissions/create

Upvotes: 1

Zig Mandel
Zig Mandel

Reputation: 19835

Service account has a separate drive (and everything else) that can only be seen through api, not the web interface. Why are you using a service account? Thats for other cases. Use regular 3-legged oauth on that gmail account to get its refresh token so you can put it there as Owner. Otherwise keep doing what you are doing, but also share it with that email so you can see it on that drive's 'shared with me'.

Upvotes: 1

Related Questions