Hello,
it seems that many of the code has been rewritten for version 0.9.x since 0.8.x so the samples from here https://github.com/google/google-api-ruby-client-samples/tree/master/service_account aren't supported. When I saw the embedded into this repo google-api-ruby-client
I saw the similar samples, but many config parameters passed via ENV vars like:
GOOGLE_CLIENT_SECRETS
GOOGLE_CREDENTIAL_STORE
GOOGLE_CLIENT_ID
GOOGLE_CLIENT_SECRET
GOOGLE_API_KEY
with no format description of the vars provided.
So the question is how to use these vars to make user authentication/authorization with a public key for the OAuth2 in 0.9.x?
UPD:
Also the plain run the app:
google-api-samples
raises the exception:
samples/cli/google-api-samples:24:in `<class:App>': uninitialized constant App::Samples (NameError)
from samples/cli/google-api-samples:17:in `<main>'
What is it?
Also looking to solve the authentication issue. Any help would be appreciated since the docs are now obsolete.
Documentation on how to authorize correctly would be helpful. The samples just error with ~/.config/google/client_secrets.json not found.
Visit https://console.developers.google.com/
Credentials -> Create credentials -> OAuth client ID -> Other
Save client ID and client secret
Enable sheets API
https://console.developers.google.com/apis/api/sheets.googleapis.com/overview
After following the above, the Ruby samples worked for me.
I got this running a month ago with google-api-client ~> 0.11.1. Though would like official docs in case I missed important details.
Here is what I did for service account authentication. This works well if you don't need to do things on behalf of other user accounts.
ENV['GOOGLE_APPLICATION_CREDENTIALS'] = '/path/to/downloaded_file.json'
How you do this will depend on your own setup.
It looks like there's an official Quickstart that uses OAuth.
It looks like a member of our great community answered your questions. Thanks Community! Please add a comment if you have any more questions and we can reopen this issue.