Byron / google-apis-rs

A binding and CLI generator for all Google APIs
http://byron.github.io/google-apis-rs
Other
983 stars 132 forks source link

google_customsearch1 and google_customsearch1-cli are currently broken due to some expectation for API keys despite using OAuth #503

Closed EatonWu closed 1 month ago

EatonWu commented 1 month ago

For the customsearch1-cli issue, I've narrowed it down to the fact that in google-apis-rs/gen/customsearch1/src/api.rs, Engine::new() always calls _doit with the dry_run variable set to true.

Within the _doit function, there is a conditional that only returns Ok with the query result if dry_run is false. I noticed that that this function returning Ok results in unreachable code, so the CLI will simply never return Ok, and never return a result.

Within customsearch1/lib.rs itself, I was under the impression that the only authorisation required was an OAuth access token, obtainable via the Google Cloud Console (https://console.cloud.google.com) and downloaded as a JSON, setting scopes, and then sending the request via an HTTPS Authorisation Request Header:

"After an application obtains an access token, it sends the token to a Google API in an HTTP Authorization request header."

However, calling CseListCall's doit() function results in a delegate api_key() call, and consequently a MissingAPIKey Error.

Am I doing this wrong?

Thanks for the help.