在我的Google开发者控制台中,我下载了凭证json文件。它看起来像这样:
client_secret-000000000-aaaaaaaaaa0a.apps.googleusercontent.json
我想把google-api-client
用于ruby。我需要将此json
文件放在哪个文件夹中?此外,我如何访问它?所有关于这方面的教程都跳过了它。
您可以将其存储在任何合适的目录中,例如config
(常规)、lib
、db
等。
要访问它,请使用:
client = Google::APIClient.new(
application_name: 'Your Google API Application',
application_version: YOUR_VERSION
)
client.authorization =
Google::APIClient::ClientSecrets.load(
File.join(
Rails.root,
'config',
'client_secret-000000000-aaaaaaaaaa0a.apps.googleusercontent.json'
)
).to_authorization