久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

使用 javascript 將文件從任何人上傳到我的谷歌驅

Upload file to my google drive from anyone using javascript(使用 javascript 將文件從任何人上傳到我的谷歌驅動器)
本文介紹了使用 javascript 將文件從任何人上傳到我的谷歌驅動器的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

我是谷歌 API 的新手.我能夠從應用程序腳本上傳此文件,并且通過該腳本上傳的任何文件都僅存儲到我的驅動器中.但是如何使用javascript做到這一點.谷歌示例:https://developers.google.com/drive/web/quickstart/quickstart-js顯示如何執行此操作,但文件會上傳到授權該應用程序的同一用戶的驅動器.如何將其限制在我的驅動器上.謝謝

I am new to google api. I am able to do this file upload from app script and any file which is uploaded through that script get stored to my drive only. But how to do this using javascript. Example on google : https://developers.google.com/drive/web/quickstart/quickstart-js shows how to do this but file gets uploaded to the same user's drive who is authorizing the app. How to restrict it to my drive only. Thanks

推薦答案

簡單的答案是你不能使用 JavaScript.原因是 JavaScript 與 OAuth2 一起使用,這需要您請求用戶許可才能訪問您的數據.

Simple answer is you cant with JavaScript. The reason being is that JavaScript works with OAuth2 this requires that you ask the user permission to access your data.

如果您想讓它訪問您的驅動器帳戶,您必須將刷新令牌保存在某個地方,然后在加載腳本時發送它.JavaScript 是客戶端的,因此任何檢查頁面上的代碼的人都將獲得他們需要的所有信息,以使用您的驅動器帳戶做任何他們想做的事情.出于安全考慮,這是個壞主意.

If you want to have it access your drive account you would have to save the refreshtoken some place and then send that when ever the script was loaded. JavaScript is client sided so anyone that checked the code on the page would then have all the information they needed to do what ever they wanted with your drive account. Security wise that's a bad idea.

我建議您考慮使用像 PHP 這樣的服務器端腳本語言.您可能需要考慮一個服務帳戶.注意:一切都將歸服務帳戶所有,因此您必須授予服務帳戶訪問您的 Google Drive 文件的權限,或者您需要將驅動器文件移動到服務帳戶.

I recommend you look into using a server sided scripting language like PHP. You might want to consider a service account. Note: everything will be owned by the service account so you will either have to give the Service account access to your Google Drive files or you will need to move your drive files to the Service account.

如果您不希望服務帳戶擁有您可以使用普通 Oauth2 保存的文件,請保存刷新令牌,然后將其存儲在服務器端代碼中,那里不會有太多的安全風險.

If you don't want the service account to have the files you could go with normal Oauth2 save the refresh token and then store it in the server sided code there wont be as much of security risk there.

這篇關于使用 javascript 將文件從任何人上傳到我的谷歌驅動器的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

discord.js v12: How do I await for messages in a DM channel?(discord.js v12:我如何等待 DM 頻道中的消息?)
how to make my bot mention the person who gave that bot command(如何讓我的機器人提及發出該機器人命令的人)
How to fix Must use import to load ES Module discord.js(如何修復必須使用導入來加載 ES 模塊 discord.js)
How to list all members from a specific server?(如何列出來自特定服務器的所有成員?)
Discord bot: Fix ‘FFMPEG not found’(Discord bot:修復“找不到 FFMPEG)
Welcome message when joining discord Server using discord.js(使用 discord.js 加入 discord 服務器時的歡迎消息)
主站蜘蛛池模板: 国产中文字幕在线观看 | 亚洲福利av | 久久视频免费看 | 国产小u女发育末成年 | 成人精品一区二区三区中文字幕 | 中文字幕亚洲视频 | www.亚洲一区二区三区 | 一区二区三区视频在线观看 | 欧美aaa一级片 | 国产综合在线视频 | 一区视频在线 | 成人在线一区二区 | 欧美日韩亚洲一区 | 黄色免费网站在线看 | 狠狠的干| 国产欧美一区二区在线观看 | 97影院在线午夜 | 欧美二区在线 | 欧美日韩久久 | 国产精品久久久乱弄 | 国产一区二区观看 | 红色av社区 | 免费在线播放黄色 | 国产精品毛片久久久久久久 | 欧美日韩高清在线一区 | 天天色天天射天天干 | 日屁网站 | 亚洲国产精品久久 | 天堂视频一区 | 3级毛片| aaa在线观看 | 久久天堂 | 香蕉一区 | 国产精品视频一区二区三 | 欧美日一区二区 | 成人精品一区二区户外勾搭野战 | 日韩欧美国产一区二区 | 久久91视频 | 久久精品超碰 | 91久久精品日日躁夜夜躁欧美 | 日本一区二区三区在线观看 |