fetch_access_token! error -> Invalid Request

430 views
Skip to first unread message

ajay singh

unread,
Feb 28, 2013, 4:03:25 AM2/28/13
to oauth...@googlegroups.com

Following is what I am trying to do -

client = Google::APIClient.new

client.authorization.client_id = 'XXXX'

client.authorization.client_secret = 'XXXXX'

client.authorization.scope = 'https://www.googleapis.com/auth/calendar'

client.authorization.redirect_uri = 'http://www.aaaaa.com/'

calendar = client.discovered_api('calendar', 'v3')

In order to get access_token to make further requests, i make a call to client.authorization.fetch_access_token!

Response I get is :

Signet::AuthorizationError: Authorization failed. Server message: { "error" : "invalid_request" } from D:/main/tools/jruby/lib/ruby/gems/1.8/gems/signet-0.4.4/lib/signet/oauth_2/client.rb:865:in `fetch_access_token'

Later I changed made a few changes and set the grant_type to password and supplied user name and password.

client.authorization.grant_type = 'password'

client.authorization.username = 'aaaaa'

client.authorization.password = 'aaaaa'

Still facing the same issue.

Documentation is not of much help. Is there any setting that I am missing?

Also, how can I get the authorization_code when making the request via google-api-client gem?


Reply all
Reply to author
Forward
0 new messages