Skip to content

Commit

Permalink
Fixes scope for GoogleDrive #121
Browse files Browse the repository at this point in the history
  • Loading branch information
netbe committed Sep 25, 2020
1 parent e7e6f1e commit 1b36ef1
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions lib/babelish/google_doc.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,16 @@ def open(requested_filename)
puts "can't open requested file"
end
end

def authenticate
# will try to get token and store in file below
@session = GoogleDrive.saved_session(".babelish.token",
nil,
Babelish::Keys::GOOGLE_DRIVE_CLIENT_ID,
Babelish::Keys::GOOGLE_DRIVE_CLIENT_SECRET)
config = GoogleDrive::Config.new(".babelish.token")
config.client_id = Babelish::Keys::GOOGLE_DRIVE_CLIENT_ID
config.client_secret = Babelish::Keys::GOOGLE_DRIVE_CLIENT_SECRET
config.scope = ["https://www.googleapis.com/auth/drive.readonly"]
@session = GoogleDrive::Session.from_config(config)
end

def file_with_name(name)
unless @session
authenticate
Expand Down

0 comments on commit 1b36ef1

Please sign in to comment.