I am using Google Drive API with my Rails application. The API is working fine. I have the following client_secret.json file:
{
\"type\": \"service_account\",
Convert the JSON object to string and store it in the ENV
You can use JSON.dump
to convert JSON object to string
and then in your controller JSON.parse(ENV['CLIENT_SECRET'])
Alternatively
you can create a google_session.rb
inside initializers
folder
$google_session = GoogleDrive::Session.from_service_account_key(
# config goes here
)
and in your controller you will have access to $google_session
global variable