3. Why google cloud storage
• 內建 CDN
• Google Cloud Storage behaves essentially like
a Content Delivery Network (CDN) with no work on
your part because publicly readable objects are, by
default, cached in the Google Cloud Storage network.
• try try see
• try 到死
• 有 USD 500 的 credit
4. OAuth2
• JWT (JSON Web Token)
• Google Cloud console
• credential: service account
• covert p12 > pem
Authentication - Google Cloud Storage — Google Cloud Platform
https://cloud.google.com/storage/docs/authentication#service_accounts
5. OAuth2
• Get token
• payload
{
iss: '460520686343-k6tfn73sentmh0ss5nu67kniorbcta8n@developer.gserviceaccount.com',
scope: 'https://www.googleapis.com/auth/devstorage.full_control',
aud: 'https://accounts.google.com/o/oauth2/token',
exp: 1418280623,
iat: 1418280563
}
• jwt sign
// sign with RSA SHA256
var cert = fs.readFileSync('google_cloud_key.pem'); // get private key
var claim = jwt.sign(payload, cert, {
Get Google JWT token.
https://gist.github.com/onlinemad/28341a343ecde186a410
algorithm: 'RS256'
});
7. Upload URI
• Upload URI, for media upload requests
• upload/storage/v1/b/bucket/o
• Metadata URI, for metadata-only requests:
• storage/v1/b/bucket/o
• APIs Explorer currently supports metadata
requests only.