繼續分享一篇在Node.js執行google cloud storage簽章的小範例程式碼: var gcloud = require('gcloud'); var project_id = 'your-project-id'; var key_path = '/path/to/keyfolder'; var key_name = 'your-project-json-key.json'; var storage = gcloud.storage({ projectId: project_id, keyFilename: key_path + '/' + key_name }); var bucket = storage.bucket('your-bucket-name'); bucket.file('your-object-name').getSignedUrl({ action: 'read', expires: Math.round(Date.now() / 1000) + (60 * 5) // 5 minutes. }, function(err, url) { if(err) console.log('>>>error:' + err); console.log('read:', url); }); 這邊是透過 gcloud 這個套件,由Google Cloud Platform Team所撰寫的... 其中使用到的service account金鑰封裝方式是json格式的那個... 整個service account的建置操作過程如下: Step1: 建立Service Account 進入頁面:Cloud Console > APIs & auth > Credentials 點選"Create new Client ID"後,選擇Service account Step2: 下載JSON Key 最後,Service account建...