Bruno
Bruno

Reputation: 319

Google Drive users do not have permissions to read file

I would like to create an application where the users could access to all my data in Google Drive.

I have implemented a 2-legged OAuth to obtain all the data from Google Drive with my server app with no user authorization. The server can obtain all the data with the 2-legged OAuth.

The problem arrives when using, for example, the link of a drive document, the users connected to my app cannot access it due to they have no permissions. I would like to know if it is mandatory give them permissions to access the files or maybe there is another service provided by google to have a comun storage for all the users without get the authorization or permissions for every single user.

I would like to know to if it is posible to use the Drive interface to show the users the documents.

Upvotes: 0

Views: 284

Answers (1)

Linda Lawton - DaImTo
Linda Lawton - DaImTo

Reputation: 117271

There are actually three ways to access Google data.

  1. Api key used to access public data.
  2. Oauth2 used to access private data. Prompts for user to give permissions to access data and grants a refresh token.
  3. Service accounts. Service accounts are preauthorized. there is no prompt to request a user permission to access the data.

I am not exactly sure what you mean by 2-legged Oauth. It sounds like you are talking about a service. You can grant the service account access to your personal drive account by sharing one or more folders with it. Note: I am not sure if you can share the root folder or not.

When you wish to allow one of your users to access a file you should have the service account add the user as reader of the file then they will have access. this can be done by inserting permissions.

Note. I am not a Node.js developer and I am not sure that service accounts are supported by Node.Js you may have to switch to a server sided language I don't know enough about it.

I do have a blog post that explains service accounts in more detail.

Upvotes: 1

Related Questions