garb icon indicating copy to clipboard operation
garb copied to clipboard

Unable to authenticate with simple login(?)

Open cboettig opened this issue 13 years ago • 19 comments

The simple login throws an error I don't understand:

Garb::Session.login("myuser", "mypassword")
Garb::AuthenticationRequest::AuthError: Garb::AuthenticationRequest::AuthError
    from /var/lib/gems/1.9.1/gems/garb-0.9.1/lib/garb/authentication_request.rb:37:in `block in send_request'
    from /usr/lib/ruby/1.9.1/net/http.rb:1322:in `block (2 levels) in transport_request'
    from /usr/lib/ruby/1.9.1/net/http.rb:2671:in `reading_body'
    from /usr/lib/ruby/1.9.1/net/http.rb:1321:in `block in transport_request'
    from /usr/lib/ruby/1.9.1/net/http.rb:1316:in `catch'
    from /usr/lib/ruby/1.9.1/net/http.rb:1316:in `transport_request'
    from /usr/lib/ruby/1.9.1/net/http.rb:1293:in `request'
    from /usr/lib/ruby/1.9.1/net/http.rb:1286:in `block in request'
    from /usr/lib/ruby/1.9.1/net/http.rb:745:in `start'
    from /usr/lib/ruby/1.9.1/net/http.rb:1284:in `request'
    from /var/lib/gems/1.9.1/gems/garb-0.9.1/lib/garb/authentication_request.rb:36:in `send_request'
    from /var/lib/gems/1.9.1/gems/garb-0.9.1/lib/garb/authentication_request.rb:49:in `auth_token'
    from /var/lib/gems/1.9.1/gems/garb-0.9.1/lib/garb/session.rb:10:in `login'
    from (irb):3
    from /usr/bin/irb:12:in `<main>'

any idea what I'm doing wrong here?

cboettig avatar Aug 23 '12 02:08 cboettig

Seems like bad credentials, but it might be a problem with the library itself. Try my fork, i just checked and it (still) works!

Sija avatar Aug 23 '12 08:08 Sija

Um, perhaps this is caused by me having the 2-step authentication configured for Google? Have you tested this function when 2-step authentication is active?

cboettig avatar Aug 23 '12 17:08 cboettig

Did you set Garb.api_key (obtainable from Google APIs Console) ? More here and here.

Sija avatar Aug 23 '12 18:08 Sija

Ah, that must be it. But not recognizing the Garb.api_key function.


irb(main):017:0> Garb.api_key
NoMethodError: undefined method `api_key' for Garb:Module

cboettig avatar Aug 23 '12 19:08 cboettig

Try using my fork as this one is, you could say… slightly dated ;)

Sija avatar Aug 23 '12 19:08 Sija

I'm a bit rusty on manual gem install from source, I've just been using sudo gem install. I clone your repo and run bundle install there?

On Thu, Aug 23, 2012 at 12:53 PM, Sijawusz Pur Rahnama < [email protected]> wrote:

Try using my fork as this one is, you could say… slightly dated ;)

— Reply to this email directly or view it on GitHubhttps://github.com/vigetlabs/garb/issues/126#issuecomment-7981915.

Carl Boettiger UC Davis http://www.carlboettiger.info/

cboettig avatar Aug 23 '12 19:08 cboettig

There's good howto over at invaluable SO — http://stackoverflow.com/questions/2577346/how-to-install-gem-from-github-source

Sija avatar Aug 23 '12 20:08 Sija

Thanks Sija for continuing to support this Gem. I was able to get the Api key to work. I was getting the error:

Garb::DataRequest::ClientError: "<?xml version=\"1.0\" encoding=\"UTF-8\"?><errors xmlns=\"http://schemas.google.com/g/2005\"><error><domain>usageLimits</domain><code>userRateLimitExceededUnreg</code><internalReason>User Rate Limit Exceeded. Please sign up</internalReason><extendedHelp>https://code.google.com/apis/console</extendedHelp></error></errors>"

If anyone else is getting this, you need to first install Sija's fork of this gem:

# Inside Gemfile
gem 'garb', :git => "git://github.com/Sija/garb.git"

Follow this with

bundle update

Next, set your api key like this:

Garb::Session.api_key = 'your_api_key'
Garb::Session.login(username, password)

After that, the error I was getting above went away.

I am a big fan of "hold my hand" sometimes - sorry if there are too many details here - but the documentation isn't great.

adamthedeveloper avatar Sep 30 '12 03:09 adamthedeveloper

Thanks! Got the 0.9.5 version installed from Sija's gem, and entered the api key, but I'm still getting stuck on the Garb::Session.login step.

Error trace isn't particularly helpful:

Garb::AuthError: Garb::AuthError
    from /var/lib/gems/1.9.1/gems/garb-0.9.5/lib/garb/request/authentication.rb:38:in `block in send_request'
    from /usr/lib/ruby/1.9.1/net/http.rb:1322:in `block (2 levels) in transport_request'
    from /usr/lib/ruby/1.9.1/net/http.rb:2671:in `reading_body'
    from /usr/lib/ruby/1.9.1/net/http.rb:1321:in `block in transport_request'
    from /usr/lib/ruby/1.9.1/net/http.rb:1316:in `catch'
    from /usr/lib/ruby/1.9.1/net/http.rb:1316:in `transport_request'
    from /usr/lib/ruby/1.9.1/net/http.rb:1293:in `request'
    from /usr/lib/ruby/1.9.1/net/http.rb:1286:in `block in request'
    from /usr/lib/ruby/1.9.1/net/http.rb:745:in `start'
    from /usr/lib/ruby/1.9.1/net/http.rb:1284:in `request'
    from /var/lib/gems/1.9.1/gems/garb-0.9.5/lib/garb/request/authentication.rb:37:in `send_request'
    from /var/lib/gems/1.9.1/gems/garb-0.9.5/lib/garb/request/authentication.rb:50:in `auth_token'
    from /var/lib/gems/1.9.1/gems/garb-0.9.5/lib/garb/session.rb:10:in `login'
    from (irb):5
    from /usr/bin/irb:12:in `<main>'

thanks again for any suggestions on how to debug this.

cboettig avatar Sep 30 '12 20:09 cboettig

@cboettig It seems you provided wrong credentials. Ensure that provided password/api_key are correct. I just checked from console and it works.

Sija avatar Oct 02 '12 09:10 Sija

Just to make sure, the key I want is the one from https://code.google.com/apis/console/ where it says:

Simple API Access

Use API keys to identify your project when you do not need to access user data. Learn more http://code.google.com/apis/console-help/#UsingKeys Key for browser apps (with referers)API key: MY-KEY-XXXX

On Tue, Oct 2, 2012 at 2:01 AM, Sijawusz Pur Rahnama < [email protected]> wrote:

@cboettig https://github.com/cboettig It seems you provided wrong credentials. Ensure that provided password/api_key are correct. I just checked from console and it works.

— Reply to this email directly or view it on GitHubhttps://github.com/vigetlabs/garb/issues/126#issuecomment-9063110.

Carl Boettiger UC Davis http://www.carlboettiger.info/

cboettig avatar Oct 02 '12 16:10 cboettig

Got the same error that's make me crazy, did you found any solution ? I spend two hours to test every solutions found on internet withou success

antho1404 avatar Jan 27 '13 16:01 antho1404

Are you using sija's fork? That worked for me once I entered the Ali key. I never got it working on my Google account that has the two step (text msg) authentication. Instead I created a second fight account with one step sub and then shared the Analytics report with that account. On Jan 27, 2013 8:40 AM, "Anthony" [email protected] wrote:

Got the same error that's make me crazy, did you found any solution ? I spend two hours to test every solutions found on internet withou success

— Reply to this email directly or view it on GitHubhttps://github.com/vigetlabs/garb/issues/126#issuecomment-12756893.

cboettig avatar Jan 27 '13 20:01 cboettig

Thx for the answer, I tested sija's fork but with my personnal Google account, I will also try to create a "fake" account and I will pray ;)

antho1404 avatar Jan 27 '13 20:01 antho1404

It didn't work with the two step authentication but worked fine with a new account.

mavericohm avatar Feb 19 '13 04:02 mavericohm

You need to add the application in the two-step security setup in Google first. Log into your Google account and go to security. Go through the steps to add a new application and it will generate a new password just for that.

Good luck.

Pierce

Raul Sann wrote:

It didn't work with the two step authentication but worked fine with a new account.

— Reply to this email directly or view it on GitHub https://github.com/vigetlabs/garb/issues/126#issuecomment-13756712.

analyticsPierce avatar Feb 19 '13 05:02 analyticsPierce

well I am stuck with this again :( can anyone tell me what are the API_KEY ?

  1. need to pass into Garb::Session.API_KEY= 'somewhere/in/directory/API_KEY.p12' .. ?
  2. Then Garb::Session.login('[email protected]','gmail_password') ?

supadhyaya avatar Jun 23 '15 15:06 supadhyaya

I am stuck with single login after enable 2-step authentication too and also have taken fork of Sija/garb still it is not working.Can anyone help me here?

manishnagdewani96170 avatar Oct 08 '15 14:10 manishnagdewani96170

Garb::AuthError: Garb::AuthError from /home/haseeb/.rvm/gems/ruby-2.0.0-p648/bundler/gems/garb-ee888166b9a0/lib/garb/request/authentication.rb:38:in block in send_request' from /home/haseeb/.rvm/rubies/ruby-2.0.0-p648/lib/ruby/2.0.0/net/http.rb:1419:in block (2 levels) in transport_request' from /home/haseeb/.rvm/rubies/ruby-2.0.0-p648/lib/ruby/2.0.0/net/http/response.rb:162:in reading_body' from /home/haseeb/.rvm/rubies/ruby-2.0.0-p648/lib/ruby/2.0.0/net/http.rb:1418:in block in transport_request' from /home/haseeb/.rvm/rubies/ruby-2.0.0-p648/lib/ruby/2.0.0/net/http.rb:1409:in catch' from /home/haseeb/.rvm/rubies/ruby-2.0.0-p648/lib/ruby/2.0.0/net/http.rb:1409:in transport_request' from /home/haseeb/.rvm/rubies/ruby-2.0.0-p648/lib/ruby/2.0.0/net/http.rb:1382:in request' from /home/haseeb/.rvm/gems/ruby-2.0.0-p648/gems/rest-client-1.6.7/lib/restclient/net_http_ext.rb:51:in request' from /home/haseeb/.rvm/rubies/ruby-2.0.0-p648/lib/ruby/2.0.0/net/http.rb:1375:in block in request' from /home/haseeb/.rvm/rubies/ruby-2.0.0-p648/lib/ruby/2.0.0/net/http.rb:852:in start' from /home/haseeb/.rvm/rubies/ruby-2.0.0-p648/lib/ruby/2.0.0/net/http.rb:1373:in request' from /home/haseeb/.rvm/gems/ruby-2.0.0-p648/gems/rest-client-1.6.7/lib/restclient/net_http_ext.rb:51:in request' from /home/haseeb/.rvm/gems/ruby-2.0.0-p648/bundler/gems/garb-ee888166b9a0/lib/garb/request/authentication.rb:37:in send_request' from /home/haseeb/.rvm/gems/ruby-2.0.0-p648/bundler/gems/garb-ee888166b9a0/lib/garb/request/authentication.rb:50:in auth_token' from /home/haseeb/.rvm/gems/ruby-2.0.0-p648/bundler/gems/garb-ee888166b9a0/lib/garb/session.rb:10:in login' from (irb):21 from /home/haseeb/.rvm/gems/ruby-2.0.0-p648/gems/railties-3.2.14/lib/rails/commands/console.rb:47:in start' from /home/haseeb/.rvm/gems/ruby-2.0.0-p648/gems/railties-3.2.14/lib/rails/commands/console.rb:8:in start' from /home/haseeb/.rvm/gems/ruby-2.0.0-p648/gems/railties-3.2.14/lib/rails/commands.rb:41:in <top (required)>' from script/rails:6:in require' from script/rails:6:in <main>'2.0.0-p648 :022 >

Haseeb717 avatar Jul 21 '17 06:07 Haseeb717