Skip to content

Commit 8243bf1

Browse files
docs(readme): improve client.js usage docs with JWT and API examples
1 parent e0dac63 commit 8243bf1

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

endpoints/getting-started-grpc/README.md

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,29 @@ $ node server.js -p 50051
1313
```
1414

1515
### Run the client
16+
For running the client locally, you'll need either an API key or a JWT auth token:
17+
18+
#### Using a JWT token (recommended for local development)
19+
You can generate a development-only JWT token using Google Cloud CLI:
20+
21+
```
22+
$ gcloud auth print-identity-token
23+
```
24+
See [print-identity-token](https://cloud.google.com/sdk/gcloud/reference/auth/print-identity-token) for more info.
25+
26+
Then run the client using this token:
1627
```
17-
$ node client.js -h localhost:50051
28+
$ node client.js -h localhost:50051 -j YOUR_JWT_TOKEN
1829
```
1930

31+
#### Using an API key
32+
Alternatively, you can use an API key from your Google Cloud project:
33+
```
34+
$ node client.js -h localhost:50051 -k YOUR_API_KEY
35+
```
36+
37+
You can create API keys in the [Google Cloud Console](https://console.cloud.google.com/apis/credentials).
38+
2039
## Running on Google Cloud Platform
2140
### Setup
2241
Make sure you have [gcloud][gcloud] and [Node.js][nodejs] installed.

0 commit comments

Comments
 (0)