How to use API Key in Google Speech grpc Java library

898 Views Asked by At

How do I use an API Key in Google Speech grpc Java or any other library. For HTTP request I am able to see that we can append key=API_KEY as mentioned in https://cloud.google.com/docs/authentication/api-keys.

But for the given libraries (https://cloud.google.com/speech/docs/reference/libraries#client-libraries-install-java) all examples show how to use the Credential file.

Please help.

1

There are 1 best solutions below

0
On

Use metadata with a key of X-Goog-Api-Key. See this other answer. If you have API restrictions, you may need additional headers. For example, an iOS example mentioned a bundle id restriction.