-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
transport/grpc: support option.WithAPIKey #485
Comments
sorry, reading this now it doesn't look like a doc bug. |
google-api-go-client/transport/grpc/dial.go Lines 119 to 121 in 334f1cf
|
Workaround for "API keys are not supported for gRPC APIs. Remove the WithAPIKey option from your client-creating call." Append the API key to the context used for the request (not for client creation). ctx = metadata.AppendToOutgoingContext(ctx, "x-goog-api-key", key) Then provide some dummy authentication: option.WithTokenSource(oauth2.StaticTokenSource(&oauth2.Token{})) |
Any better fix for this issue ? |
@zhoub As of right now, I think this is still the best solution. |
google.golang.org/ap/option says:
Not true, though, API keys can be used with gRPC.
Need to use the x-api-key metadata key:
The text was updated successfully, but these errors were encountered: