久久久久久久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影院| 欧美 视频| 热99在线 | 国产精品成人免费 | 草樱av| 国产精品高潮呻吟久久av野狼 | 国产1区2区在线观看 | 亚洲人成在线播放 | 久久国产精品偷 | 亚洲 91| 日本a∨精品中文字幕在线 亚洲91视频 | 国产精品久久久久一区二区三区 | 四虎在线播放 | 亚洲 中文 欧美 日韩 在线观看 | 色综合99 | 久久一区二区视频 | 狠狠久久综合 | 51ⅴ精品国产91久久久久久 | 欧美视频免费在线 | а天堂中文最新一区二区三区 | 久久网站黄| 亚洲在线一区二区三区 | 久久精品国产一区 | 91久久国产| 日韩福利 | 黄色一级大片在线免费看产 | 日韩在线观看视频一区 | 亚洲精品一区二区 | 欧美日韩在线电影 | 国产aaaaav久久久一区二区 | 伊人网国产 | 日本免费在线观看视频 | h视频免费在线观看 | 鸳鸯谱在线观看高清 | 天天夜碰日日摸日日澡 | 亚洲国产午夜 | 亚洲高清免费 | 国产精品久久久久影院色老大 | 亚洲精品久久久久久久久久久久久 | 欧美一区二区免费 | 亚洲国产精品久久久 |