nerdsfornature / changebrackets

This is a public repo for our project that uses angle brackets to monitor environmental change
MIT License
5 stars 4 forks source link

Auth error on Heroku install because OAuth now required #5

Closed danrademacher closed 8 years ago

danrademacher commented 9 years ago

Just realized that the automated harvesting scripts for Rim Fire and Morgan Fire have been failing since late June. Errors like this:

2015-08-06T04:30:20.182828+00:00 app[scheduler.5183]: /app/vendor/bundle/ruby/2.0.0/gems/google_drive-0.3.9/lib/google_drive/session.rb:93:in `rescue in login': Authentication failed for changebrackets@gmail.com: Response code 404 for post https://www.google.com/accounts/ClientLogin: https://developers.google.com/accounts/docs/AuthForInstalledApps (GoogleDrive::AuthenticationError)

https://developers.google.com/identity/protocols/AuthForInstalledApps image

danrademacher commented 9 years ago

Seems like this part just plain won't work anymore: https://github.com/nerdsfornature/changebrackets/blob/bd6f245debbec2798ad092a47af54d1aa64e6e58/fireslurp.rb#L234

However, this boggles my mind: https://developers.google.com/identity/protocols/OAuth2.

@kueda not that you signed up for long-term support of this little side project, but, well, any ideas on best road to repair of this issue?

(Also: I suppose it's possible I'm misdiagnosing it, but the evidence above seems compelling.)

kueda commented 9 years ago

I think it's fixable, but it will be a bit fussy. Basically we're going to

  1. Set up a project in the Google Developer Console and create a Service Account: https://developers.google.com/identity/protocols/OAuth2ServiceAccount
  2. Grant the service account's fake email address edit permissions for the sheet
  3. Attempt to use Google Ruby client to retrieve an access token for the service account: https://developers.google.com/api-client-library/ruby/auth/service-accounts
  4. Use the access token to start the Google Drive session instead of the deprecated username/password flow: https://github.com/gimite/google-drive-ruby

I can look into this some time in the next week or so, but you need to decide if you want a N4N Google account to own that Developer Console project. If you do, you should make that and add me as a collaborator. If you don't care I can try to set it up.

danrademacher commented 9 years ago

OK, great. I set up a project under a Nerds for Nature email and sent you an invitation to be a co-owner.

danrademacher commented 9 years ago

@kueda did you have a chance to look at this yet? I could try to recruit help this very evening, but if you're on the cusp of knocking it out, I'd probably just go with that

kueda commented 9 years ago

Actually just remembered this today and was about to take a look. If I don't get anything done by the end of tomorrow, go ahead and pursue alternate strategies. Apologies, this totally slipped my mind.

On Tue, Aug 18, 2015 at 7:33 PM, Dan Rademacher notifications@github.com wrote:

@kueda https://github.com/kueda did you have a chance to look at this yet? I could try to recruit help this very evening, but if you're on the cusp of knocking it out, I'd probably just go with that

— Reply to this email directly or view it on GitHub https://github.com/nerdsfornature/changebrackets/issues/5#issuecomment-132424878 .

danrademacher commented 9 years ago

No worries. I forgot until today as well. Thanks for checking it out!

danrademacher commented 8 years ago

jeez, I never closed this out...