[請益] 存取Google Drive

看板Soft_Job (軟體人)作者 (珍惜當下)時間8年前 (2017/06/19 23:57), 編輯推噓1(1016)
留言17則, 3人參與, 最新討論串1/1
想請教在Google Developer Console設定了client_id及Appkey, 然後開發了一個Google picker的程式, 當使用者點了使用該client_id及appkey的Google picker程式, 似乎只有使用該開發者的Google帳號才能登入? 要怎麼讓任何人都可以用自己的Google帳密登入, 然後登入後的picker裡面只看到自己的google dirve file呢? -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 123.195.6.142 ※ 文章網址: https://www.ptt.cc/bbs/Soft_Job/M.1497887830.A.E2D.html

06/20 00:31, , 1F
要分享的資料夾要設定成知道連結的人都可以閱讀
06/20 00:31, 1F

06/20 00:34, , 2F
但是在登入時,似乎只能用開發者的帳號登入,若使用其他帳
06/20 00:34, 2F

06/20 00:37, , 3F
號登入,則會顯示“這個應用程式尚未經過驗證,無法存取以
06/20 00:37, 3F

06/20 00:37, , 4F
下範圍::{invalid = [https://www.googleapis.com/auth/d
06/20 00:37, 4F

06/20 00:38, , 5F
rive.readonly]}。..."的訊息在登入視窗上
06/20 00:38, 5F

06/20 01:18, , 6F
你是要讓使用者上傳檔案到你自己的google drive嗎?
06/20 01:18, 6F

06/20 01:18, , 7F
那你要使用service account,首先你要授權給這個account
06/20 01:18, 7F

06/20 01:19, , 8F
這樣其他使用者才可以使用這個account上傳檔案到你的driv
06/20 01:19, 8F

06/20 01:19, , 9F
Google所有的service都需要OAuth認證
06/20 01:19, 9F

06/20 01:19, , 10F
service account有點類似super user account
06/20 01:19, 10F

06/20 01:20, , 11F
你授權給它 它再代為操作
06/20 01:20, 11F

06/20 01:20, , 12F
另外service account沒有UI可以用 一定要透過API
06/20 01:20, 12F

06/20 01:21, , 13F
應該是說沒有Google Drive UI可以瀏覽檔案
06/20 01:21, 13F

06/20 01:21, , 14F
但設定還是可以在console那邊設定
06/20 01:21, 14F

06/20 01:21, , 15F
「Using OAuth 2.0 for Server to Server Applications」
06/20 01:21, 15F

06/20 02:30, , 16F
是要限制只有某些人用他們的google帳號登入後,可以看到同
06/20 02:30, 16F

06/20 02:31, , 17F
樣的資料夾(使用google picker), 或是可以存取同樣的檔案
06/20 02:31, 17F
文章代碼(AID): #1PH_HMuj (Soft_Job)
文章代碼(AID): #1PH_HMuj (Soft_Job)