AuthorizationError error while using google-drive gem

I am using google_drive gem.

This is config.json .

{
  "client_id": "*****.apps.googleusercontent.com",
  "client_secret": "*****",
  "scope": [
    "https://www.googleapis.com/auth/drive",
    "https://spreadsheets.google.com/feeds/"
  ],
  "refresh_token": "*****"
}

Code: Add row to google sheet.

session = GoogleDrive::Session.from_config("#{Rails.root.join('config/config.json')}")
ws = session.spreadsheet_by_key(ENV["GOOGLE_SHEET_KEY"]).worksheets[0]
num_rows = ws.num_rows

worksheet_row.each_with_index do |column, index|
  ws[num_rows + 1, index + 1] = column
end

It was working but recently I am getting this error.

Signet::AuthorizationError (Authorization failed.  Server message:
{
  "error": "invalid_grant",
  "error_description": "Bad Request"
}):

Any idea?

Hello @yudechen,

I would suggest you to check the tips here:

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs