Google Drive/Doc API Remove DOCX password - google-drive-api

We are looking at a way to remove the opening password (knowing the password) from a word docx file in Google Drive API or Google Doc API.
Google Drive viewer is able to detect there is a password ask for it.
Any experience in doing so programmatically assuming the password is known?

Answer:
It is not possible to do this programmatically, either with Drive API or Docs API. Neither of them include any way to handle passwords.
Feature request:
I'd suggest you to request this feature in Issue Tracker using this template.

Related

Google Drive API 403 for Google Docs files specifically

I have been running GDrive API v3 using our Node.js API for awhile now (1+ year), and everything has been functional for creating (drive.files.create) & reading (drive.files.get) DOCX files through the Google Drive API logic using a service account. Everything has been working perfectly fine.
Today I am trying to extend our infrastructure to handle some generic Google Docs files (rather than the existing DOCX stored within GDrive) using the same service account, but the GDrive API is now returning a 403 "Forbidden" error for these files specifically. I can't seem to figure out why there would be a difference in permissions for two file formats that are within the same service account (is the owner of both) and are using the same OAuth token system that I set up originally. The service account itself created the file, so I am a little shocked that it can't then access the same file using the GDrive API.
My question is, is it not possible to use GDrive API to access Google Doc files, even when the files are within a GDrive folder? I can't seem to find any definitive information online on whether we specifically have to use the Google Docs API to access Docs files (seems silly if true). If it is possible, is there an alternative SCOPE that I need to assign to this service account to access Google Docs items specifically? Right now the only SCOPE assigned is https://www.googleapis.com/auth/drive, which according to documentation should be enough to access all of our GDrive files.
I can share some code, but there is not exactly a lot more than what I explained above. I would like to not have to entirely re-do my GDrive OAuth permissions if possible, as that took me a long time in the first place, but if that is the only way, I would love to hear suggestions.
Thanks!

Direct upload files from Browser to Google Drive Service Account without User Authentication

I am looking for a solution on the mentioned issues below. I would be grateful if someone could help us on this.
UPLOADING FILES DIRECTLY ON GOOGLE DRIVE SERVICE ACCOUNT FROM BROWSER WITHOUT USER AUTHENTICATION.
We would like to use our Google Drive Service Account as a storage instead of our Web Server disk space.
We are currently using DropzoneJS and Custom JS to upload files directly to our Web Server.
After that we are using Google Drive PHP SDK to upload those files on our Google Drive Service Account using Google Drive API.
Looking for Solution: We would like our users to upload files directly to our Google Drive Service Account without authenticating using their own Google account.
Is there a way for our users so they can upload files directly to our Google Drive Service Account by implementing JavaScript.
Looking forward to hearing from the helping genius.
Yes, by using Google Service Accounts you've just mentioned. Following Google service account guide you'll need to Setup a Service Account in Google Developer Console first.
Sign-in to Google API Console.
Create new project or use an existing one.
Enable Google Drive API
ClicK "Credentials" and "Create new oAuthClientID".
Select "Service account" and create new Client ID.
You will choose be asked to download your private key in JSON or P12 format.
After private key download, a password for accessing it will be shown in pop-up. Make sure you dont forget it.
Keep the private key in an accessible location, you'll be needing it later for your app.
After that you will see "Client ID" and "Email address" for your application.
Go to you Google Drive. Create some folder, and open "Sharing settings" for it.
Add your service email to the list of allowed users and allow it to edit the contents of that folder.
Remember your Drive folder ID like 0Bzgk4zccLwI7nXpRNG1yeDNxrYPU from drive.google.com/drive/folders/0Bzgk4zccLwI7nXpRNG1yeDNxrYPU.
After the setup, it's time to prepare making authorized API calls using JWT. Additional info that might help with the guide is a relevant post found here.

When/why can file.downloadUrl be empty for a PDF file selected from Google Drive?

Using js file picker to select PDF files from Google Drive.
I'm encountering an instance when the downloadUrl is undefined.
I don't understand what can cause this.
I know downloadUrl can be empty for native Google formats, but these are PDF files.
I'd like to know what scenarios (except native Google formats) can cause an empty downloadUrl.
Thanks
You should use the Drive API to fetch the picked files' metadata in order to retrieve the downloadUrl. https://developers.google.com/drive/v2/reference/files/get
Native Google formats can be downloaded (converted and downloaded) via their exportLinks: https://developers.google.com/drive/v2/reference/files#exportLinks
The response I was receiving was 403.
And the scenario was user accessing "work" Drive (Google Drive for your domain)
Turns out Google Drive for your domain Administrators can restrict the permission to install third party apps.
https://support.google.com/a/answer/6105699?hl=en
User will still be able to allow access for the app and select files. Its just going to fail every time with a 403. Very confusing UX.

Is it possible to access data in Google Drive using a regular account without user authentication?

I have a web application which have a document upload/download feature. I'd like to use Google Drive for storing these documents. Is it possible to have the web app own a regular Google account but that doesn't require user's consent for the app to access the Drive? Or is this only possible using a Service account?
Yes it's possible. see stackoverflow.com/questions/19766912/… for a set of steps to do this. "own" isn't quite the correct term, "access" would be better.

How do I change the authorization domain using Google Drive?

I have a Google Drive enabled application that I'm trying to get into the Google Apps Marketplace. It was rejected because:
Your request begins : https://www.google.com/accounts/o8/ud?openid
It should look more like :
https://www.google.com/a/DOMAIN_GOES_HERE/o8/ud
I've not been able to get an response from anyone at Google as to what this means.
We based our Drive operations on the Java DrEdit example.
Is it possible, using the Google API Java Client Library, to use the second domain above, if so, how?
Also, even if it can be accessed, does it have access to the file permission settings I need in order to perform the various Drive operations?
The answer is that it's not possible at this time. The variant of OAuth2 used with Google Drive does not permit forcing login to a particular domain.
The Google Apps Marketplace storekeepers should be allowing such applications to be accepted until a workaround is found.