Open aep opened 9 years ago
Could you paste the code making a request? There is an error in your request.
I was having the same issue and followed the steps exactly as given in the readme. I also checked to make sure that my computer clock was correct and that the secret key is valid and authorized the provided client_id within the scope of the big_query api.
opts = {}
opts['client_id'] = ENV["GOOGLE_BQ_CLIENT_ID"]
opts['service_email'] = ENV["GOOGLE_BQ_SERVICE_EMAIL"]
opts['key'] = './my-secret-key.p12'
opts['project_id'] = ENV["GOOGLE_BQ_PROJECT_ID"]
opts['dataset'] = 'gdelt-bq:full.events'
bq = BigQuery::Client.new(opts)
When I try the code within the initialize function using another provider as the client, my credentials are accepted and I receive a token.
@client = Google::APIClient.new()
begin
key = Google::APIClient::KeyUtils.load_from_pkcs12(opts['key'], 'notasecret')
rescue ArgumentError
key = Google::APIClient::KeyUtils.load_from_pem(opts['key'], 'notasecret')
end
@client.authorization = Signet::OAuth2::Client.new(
token_credential_uri: 'https://accounts.google.com/o/oauth2/token',
audience: 'https://accounts.google.com/o/oauth2/token',
scope: 'https://www.googleapis.com/auth/bigquery',
issuer: opts['service_email'],
signing_key: key)
refresh_auth
@bq = @client.discovered_api("bigquery", "v2")
@project_id = opts['project_id']
@dataset = opts['dataset']
I tried out the google-api-client
gem directly and the exact code provided in the initialize
function of BigQuery worked. Submitted a PR for updating the gem dependency.
the very first example code in the readme fails for me with: