I am trying to authorize files on my google drive with specific APP authorization I created. As files on my google drive can only be manipulated by its authorized app, is there any way I can convert these "None" authorized file with APP authorization? And, if yes, by which function?
I looked all over the tutorial document but only find discussion about permission. The only method I can think about is uploading these files to google drive with upload function from my created app. But I guess there is a much smarter way. Do any one has the same experience?
Here list my steps to create authorized file:
First, I start my app from using sample code, DrEdit. https://developers.google.com/drive/examples/python;
From the code, I successfully open new files and saw them listed on my google drive.
From view authorized app, I can clear see these apps created from my app have their authorization signed with app ID. The other files original belong to me have these authorization signed as "None".
I had the same issue and had to change the scope from https://www.googleapis.com/auth/drive.file to https://www.googleapis.com/auth/drive which gives full access to all drive files rather than just the ones created by the app.
Related
I have a web app created using google script which is distributed in a team,They will use it to upload some files.
I want to save those files into my drive rather than their own accounts.
According to my research I can only save it my account If I publish that app with option Execute as me and option who has access with anonymous.
But I want to Execute as user accessing this app option(that required user to authorized).
Anyone know how to solve this?
Create a service account and enable Domain-wide Delegation of Authority on it. Then you can execute saves to the Google Drive under your account. You'll need to leverage a Google OAuth2 library.
Here's a good one:
OAuth2 for Apps Script
Is there a way to view & manage the scripts I have deployed as a web app through the Google Apps Script Editor?
I stored a script on my google drive, opened it with Google Apps Script, and deployed via 'Publish -> Deploy as Web App'. After testing the script/webapp works correctly, I deleted the script project from my google drive and found that the web app is still functioning.
I can't find a way to view a list of, or manage the scripts after they have been published. Is there a console or dashboard that will show all my published scripts?
The file may still be available in the Trash or Archives folder. Searching for type:script will give you a list of all stand alone script files. Also type:script is:trashed will find any in the trash folder.
Finding files with bound scripts associated (the script is embedded in the file) as well as any with specific permissions can be done by looking at your account's permissions. This will list every file that has had some sort of permission request. If a bound script does not require any permissions granted, I know of no way to finding the file. To see the files you have granted permission to, use this link: https://myaccount.google.com/permissions
If I open the shareable link I have got for a file from Google Drive in the browser, I always get either to the Drive's internal preview program or to a download page (See below).
I would like to know whether there is a programmatic way to launch a specific drive-connected application (with confirmed access permissions) to open a file for which I have the link (and thus, the ID as well).
I don't want to do this through the drive's interface, but rather within my program. Let's say I want to let the users browse their files and open them in the browser with their default app as they have defined it on their drive (and let's say I already know that app).
To make it clear, I just want to achieve what Google Drive's interface does in the browser: You click a file, and it opens in a new tab in your default app.
In my opinion, this is possible with the use of Advanced Drive Service and Drive Service.
Advanced Drive Service
The advanced Drive service allows you to use the Google Drive web API in Apps Script. Much like Apps Script's built-in Drive service, this API allows scripts to create, find, and modify files and folders in Google Drive. In most cases, the built-in service is easier to use, but this advanced service provides a few extra features, including access to custom file properties as well as revisions for files and folders.
and for the Drive Service, you can use getUrl() method to get the URL that can be used to open the File in a Google App like Drive or Docs.
This service allows scripts to create, find, and modify files and folders in Google Drive.
Detailed information and sample codes regarding these services can be found in the documentations.
What I trying to do here is an application that connects to bigquery, executes some query and writes a spreadsheet in current user's Google Drive.
I know that I can change the "Execute app as" option when deploying the app. But when I do this, and the user try to use the app, Google asks for permission to access the BigQuery.
I do not want to give permission to each user to access BigQuery.
We have about 50 ~ 100 users who will use (and this number can increase)
Some images:
When access the application's url: http://i.imgur.com/kGzJ3ps.png.
When the user clicks in the "continue" button:
http://i.imgur.com/4cRmhZ6.png
Hope I've been clear.
You would probably need an App, that had people sign in with their Google account using oAuth2
Google Accounts Authentication and Authorization
I think that this link gives an overview of what your options are:
Permissions and Types of Scripts
I guess you would need to have an App, that ran as User at the keyboard, so that the spreadsheet saved to their Google Drive. If you wanted the user to be able to download a file to their computer drive, that's a little different.
Just use HTML Service. It's basically just building a website. You just don't have a domain name. But the spreadsheet you are distributing doesn't have a domain name.
HTML Service Google Documentation
From an Apps Script HTML Service, you can write to Spreadsheets, Documents, and run HTTP Requests (urlFetch).
URL Fetch Service
The permissions in the Apps Script App can be set to run the Apps Script file as yourself, with access to anyone, even anonymous. That way, the user will never be asked for permission for any files that you own. You will need to authorize it once, the first time any script that needs access to your files is run.
Because anyone could run your Apps Script App, you might want to have a log in system to authenticate users.
You would need to use the Big Query API with Apps Script urlFetch to access Big Query.
So, with the HTML Service, you can do most everything you could do with HTML, CSS, and Javascript on a regular website. You can create custom input forms, have different pages and display data in tables. Plus it's served over HTTPS.
One solution that you can use if you don't want all your users to enable BigQuery is to use a webapp deployed as a service running as "you" and that will respond to an urlFetch coming from each user through the script they run as "themselves".
This service will be deployed as any other webapp using a doGet main function and return its data using contentService
Yes, that is possible. Check out this answer here: Using Advanced Google Services with Service Account and also check this awesome library: https://github.com/googlesamples/apps-script-oauth2
Is it possible to use Google apps scripts deployed as a web app to integrate into the Google Drive UI?
i.e. opening files similar to: https://developers.google.com/drive/about-sdk#create_and_open_files_directly_from_the_drive_ui
But using Google scripts: https://developers.google.com/apps-script/
Scripts do have access to a drive api, but I'm unsure if they have the capability to integrate into the Drive UI?
Yes. You can create a script, deploy it as a web app and call it from the Drive UI as shown in the link you provide. Your script is passed parameter from the Drive UI (including for example, the folder currently selected) and you work from there... I use this mechanism to work with a folder structure representing client activity. Selecting a client folder, I can choose to open with my script or the usual Drive options. My script checks the parameters passed by drive and responds with an appropriate user interface for the next step.