Skip to content

Instantly share code, notes, and snippets.

@amitpatelx
Created June 18, 2018 12:02
Show Gist options
  • Save amitpatelx/cb74b10779dfe8f205c0066c2c4628af to your computer and use it in GitHub Desktop.
Save amitpatelx/cb74b10779dfe8f205c0066c2c4628af to your computer and use it in GitHub Desktop.
Access google drive API
require 'google/apis/drive_v3'
require "googleauth"
credentials =
Google::Auth::UserRefreshCredentials.new(
client_id: "854280762506-lrrj2ajqh9b.apps.googleusercontent.com",
client_secret: "jWiGrijiFCNRmig1s3aQt",
scope: ["https://www.googleapis.com/auth/drive"],
additional_parameters: { "access_type" => "offline" })
credentials.refresh_token = '1/clpHfRpyVonjRpYFyfstY3zD9TSX6MgcX2C1lJ-RTEQ'
credentials.fetch_access_token!
service = Google::Apis::DriveV3.new
service.authorization = credentials
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment