What authorization token is required for the JSON API for Google Cloud Storage?

I am learning Google Cloud Storage, JSON api, simple download:

https://cloud.google.com/storage/docs/json_api/v1/how-tos/simple-upload

This example says that sending a message is as follows:

POST https://www.googleapis.com/upload/storage/v1/b/myBucket/o?uploadType=media&name=myObject HTTP/1.1
Content-Type: image/jpeg
Content-Length: [NUMBER_OF_BYTES_IN_FILE]
Authorization: Bearer [YOUR_AUTH_TOKEN]

[JPEG_DATA]

And then I created the Account Services API.

But how can I determine [YOUR_AUTH_TOKEN]to use from my newly created service account?

+4
source share
1 answer

Google Cloud OAuth 2.0 . . , Google, . Google nitty-gritty: https://developers.google.com/identity/protocols/OAuth2

. , , JWT, , , JWT Google . : https://developers.google.com/identity/protocols/OAuth2#serviceaccount

, , gcloud , :

$> gcloud auth activate-service-account myaccount@gserviceaccounts.com --key-file=creds.json
$> gcloud auth print-access-token
+8

Source: https://habr.com/ru/post/1666769/


All Articles