Bad Authentication Error Rails connecting to google drive

前端 未结 3 1856
被撕碎了的回忆
被撕碎了的回忆 2021-01-19 04:20

I have a contacts controller which has a method to connect and save the data submitted from the form to a spreadsheet in my account on google drive (app/models/contact.rb):<

3条回答
  •  花落未央
    2021-01-19 04:49

    The code is good (you can check it against the learn-rails example application). It looks exactly like the code from the Learn Ruby on Rails book.

    That means the problem is a result of an environment or configuration issue.

    First, are you running locally, or do you have the problems after deploying to Heroku?

    If running locally, here are things you can try to troubleshoot:

    1) Try restarting the web server. When you change configuration files, the server has to be restarted.

    2) Replace ENV["..."] in the code and use the credentials directly ("hardcode the credentials"). Be careful not to check the code into the git repo with the hardcoded credentials (and don't push to GitHub because you would expose your credentials).

    3) Can you send email from the application? Comment out the code that updates the spreadsheet and you should be able to send email if your credentials are correct.

提交回复
热议问题