سؤال

I am currently developing a ruby on rails application which includes the gattica gem to fetch Google Analytics data. When I fetch my data: https://github.com/activenetwork/gattica

gs = Gattica.new({:email => 'johndoe@google.com', :password => 'password', :profile_id => 123456})
results = gs.get({ :start_date => '2008-01-01', 
                   :end_date => '2008-02-01', 
                   :dimensions => 'browser', 
                   :metrics => 'pageviews', 
                   :sort => '-pageviews'})

on development I will simply receive a response which I can parse to my application.

However on production the page returns a 500 error and in my Gmail inbox I receive a message about a suspicious login being caught.

Is there any way I can fix this issue?

PS: my application is hosted on Heroku.

With kind regards, Dennis

هل كانت مفيدة؟

المحلول

You're getting the 500 error because Google is blocking your heroku ip from accessing your account. They aren't sure it's you.

You need to change your activity settings to authorize that ip/domain.

Read this: https://support.google.com/accounts/answer/1144110?hl=en&ref_topic=2401957

Also, its a good idea to read your logs when debugging these kinds of errors. Rails.logger.debug results could shed some light.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top