How to make the file shareable using google drive api

后端 未结 4 1194
悲哀的现实
悲哀的现实 2021-01-13 05:37

I am trying to get the file using google drive api, by default the file is not shareable i want to make it shareable.

Here is my code:-

    

        
4条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-01-13 05:49

    The issue I was having was I did not enable the Google Drive API in my Google developer console and I did not load the 'client' library in order for gapi.client.request() to work properly with Google Picker.

    Below is a working example for a user to click a "share" button, authorize permission to their Google Drive, select multiple images or videos from the Picker modal, and return the file hyperlinks with 'anyone with the hyperlink can view' permissions.

    Prerequisites:

    • Setup your credentials in the Google developer console
      • Obtain your developer ID, client ID, and app ID
    • Enable both the Picker and Drive APIs in the developer console

    The javascript code:

    Then the button to call everything in the HTML:

提交回复
热议问题