Skip to content

Commit b986f66

Browse files
authored
Update storage README.md
Add missing option how to use the storage client with an API key. Update button names to refer to the actual names in the UI.
1 parent feb8b59 commit b986f66

1 file changed

Lines changed: 10 additions & 4 deletions

File tree

packages/storage/README.md

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,20 +90,26 @@ If you are not running this client on Google Compute Engine, you need a Google D
9090
* Google Cloud Storage
9191
* Google Cloud Storage JSON API
9292
4. Navigate to **APIs & auth** > **Credentials** and then:
93-
* If you want to use a new service account, click on **Create new Client ID** and select **Service account**. After the account is created, you will be prompted to download the JSON key file that the library uses to authenticate your requests.
94-
* If you want to generate a new key for an existing service account, click on **Generate new JSON key** and download the JSON key file.
93+
* If you want to use a new service account key, click on **Create credentials** and select **Service account key**. After the account key is created, you will be prompted to download the JSON key file that the library uses to authenticate your requests.
94+
* If you want to generate a new service account key for an existing service account, click on **Generate new JSON key** and download the JSON key file.
95+
* If you want to use a new API key, click on **Create credentials** and select **API key**. After the API key is created, you will see a newly opened modal with the API key in a field named **Your API key** that the library uses to authenticate your requests.
96+
* If you want to generate a new API key for an existing API key, click on an existing API key and click **Regenerate key**.
9597

9698
``` js
9799
var projectId = process.env.GCLOUD_PROJECT; // E.g. 'grape-spaceship-123'
98100

99101
var gcs = require('@google-cloud/storage')({
102+
// 1. Specify projectId
100103
projectId: projectId,
101-
104+
// 2. Specify authentication
105+
// To authenticate with a service account key use
102106
// The path to your key file:
103107
keyFilename: '/path/to/keyfile.json'
104-
105108
// Or the contents of the key file:
106109
credentials: require('./path/to/keyfile.json')
110+
111+
// To authenticate with an API key use
112+
key: 'yourKeyContent'
107113
});
108114

109115
// ...you're good to go!

0 commit comments

Comments
 (0)