Google Drive File Sharing

Using the web interface of Google Drive, I right-click on the file, select "sharing" to go to "Sharing settings". I installed the file in "Publishing on the Internet - anyone on the Internet can find and watch."

Then I copy the Share link, in which case it is: https://docs.google.com/open?id=0B6Cpn8NXwgGPbFBPMEh5VHc1cUU

Then click Finish.

If I open another browser, not cookies and try to visit the link, I am redirected to the login page for Google. I assumed that this option means that authentication is not required to view the file. Is this expected behavior?

I try to do the same through the API, and I do not get the expected result either when setting permissions for the public, setting someone as a reader, and using the webContentLink value for the file as the published URL. Also in this case, if I go to the link when you are not logged into Google Apps, I will be redirected to the entrance.

I call the following method to set permissions using this:

thePermission = insert_permission(userNickName,file['id'],"me","anyone","reader") 

method:

 def insert_permission(userNickName,file_id, value, perm_type, role): credentials = get_stored_credentials(userNickName) service = CreateDrive(credentials) if service is None: return """Insert a new permission. Args: service: Drive API service instance. file_id: ID of the file to insert permission for. value: User or group e-mail address, domain name or None for 'default' type. perm_type: The value 'user', 'group', 'domain' or 'default'. role: The value 'owner', 'writer' or 'reader'. Returns: The inserted permission if successful, None otherwise. """ new_permission = { 'value': value, 'type': perm_type, 'role': role } try: return service.permissions().insert( fileId=file_id, body=new_permission).execute() except errors.HttpError, error: print 'An error occurred: %s' % error return None 

I am asking about the user interface UI mainly in this question, since it seems simpler to find out if I expect the correct result using what Google did.

+4
source share
1 answer

I finally found a problem in my case. My GAE application used Federated Login for Authentication Settings instead of the Google Accounts API. Everything worked with the Google Drive API. I can put files, delete, move, you name it, with Oauth login. But for some time I could not publicly publish files from Google Drive created from my GAE application. I have always been asked to log in if you are trying to view these files without logging in to Google Apps.

I decided to refuse access to Oauth for GAE and go with the logins to Google accounts, since everyone who uses the application will now need Google Drive. After switching the GAE application in the control panel from Federated to Google Accounts, I can happily share files with the public without having to log in.

So, it seems that Google Drive does not yet fully support Federated Login in GAE, which is hardly worth complaining about since Federated Login is experimental.

+2
source

All Articles