A
A
Alexandrqt2016-08-08 23:00:30
Google
Alexandrqt, 2016-08-08 23:00:30

Google drive authorization without script user participation?

Good afternoon!
I've been sitting in the google docks for 3 days - I can't solve the problem. Maybe someone faced a sub-problem. You need to write a php script to work with google drive.
The problem is that the application accesses a specific (one) google drive and does not require authorization from the user.
That is, there are some documents on the disk. The user selects a document from the list and it should be copied to the same disk (to a specific folder) and access rights will be set on the copy of the document (access to editing the accounts that the user specified) something like this.
It is possible to implement application authorization without user participation, like OAuth 2.0 for Server to Server Applications (only application data, as I understand it, work with cloud services and you need it with google drive)

Answer the question

In order to leave comments, you need to log in

3 answer(s)
R
Rou1997, 2016-08-08
@Rou1997

You are mistaken, Server-to-server is suitable not only for Google Cloud, but also for many other services, so enable the API in Google Drive in your account, create a so-called "service account" there (service-account.json) and log in, this is standard for all Google services.

D
Dimonchik, 2016-08-09
@dimonchik2013

With GoogleAPI, you can work without a user if you have a token, but getting the token itself once needs to be done through the browser
, most likely, here
stackoverflow.com/questions/31223166/how-to-upload...
https://pypi.python.org /pypi/PyDrive
uses exactly this method

A
Alexandrqt, 2016-08-09
@Alexandrqt

Rou1997 - I also think there should be a way out, but it doesn't work, if there is an example of Server-to-server authorization, I will be very grateful. With those examples that I played around in the documentation, or there are a lot of errors, or the application authorizes in some unknown place, creates documents somewhere but not in the May account and does not see the files that are on the disk. As I understand it, the script works with the application folder to which the user does not have access, but how to work with the folders and files of the user
dimonchik2013 - thanks for the tip, this option is still working, you still need to test it.
And with Server-to-server the question is still open if anyone has an example of authorization skinte pliz

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question