-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
api requests are not working, bad request #1
Comments
Hi @tompata, can you please post the code that's in your OAuth callback handler? And your code for when you initialize a Gplus client with a stored OAuth token? Thanks :) I'm working on a Rails example app using Gplus at the moment that might be helpful too. I will link to it soon. |
Hi @nfm, here's the callback (in the controller): def googleplus_callback And this is where I initalize the client:
The example rails app is working at you, right now? Thanks |
I'm using gplus gem v1.0.0, oauth2 v0.5.1 |
And there was another issue with the refresh token. Google only gives back refresh token when i send the 'access_type=offline' request parameter with the authorize url. http://code.google.com/apis/accounts/docs/OAuth2WebServer.html#formingtheurl |
@tompata Thanks for the bug reports. I will push the Rails example app later today. In the meantime, your code is good, except you are calling If you remove the line You're right, there is also an issue with the refresh token. It seems like Google has changed the default The documentation at http://code.google.com/apis/accounts/docs/OAuth2WebServer.html has conflicting information. In the "Forming the URL" section, it states "This parameter defaults to online". But in the "Offline Access" section, it states "Offline is currently the default (and only) option for web server applications. This default will change soon to online. This section describes how to request offline access after this change." I believe it has actually already been changed to default to online. I will update gplus so that the |
Hi @nfm, thanks for the details and the new gem version! it's getting better :) @auth_url = @gplus.authorize_url(:access_type => 'offline') |
Hi @tompata, I've just released gplus 2.0.0 and an example Rails app. 2.0.0 should fix #1 and #2. Please let me know if it does or not. 2.0.0 includes some breaking API changes, which is why I've bumped the major version. They tidy up some discrepancies, and make it possible to pass more options through to OAuth2. Take a look at the CHANGELOG for full details about how to migrate from 1.0.x to 2.0.0. Basically, you'll need to:
Let me know if you need any help. I've updated the documentation to reflect these changes. Thanks for being an early user! |
Hi @nfm, mega thanks for the new release, it's working now and fixed our issues! in your example rails app, there's a mistype, here: and another important "notice", which is connected to oauth2: and a small suggestion: you should give some debugging / logging option to developers, because debugging is very difficult now thanks again, |
We're try to use gplus, but after a successfull oauth process, the normal api requests are not working:
Gplus Client: #<Gplus::Client:0x6aa9780 @oauth_client=#<OAuth2::Client:0x6aa95c8 @site="https://www.googleapis.com/plus", @id="XXX", @secret="XXX", @options={:token_method=>:post, :connection_opts=>{}, :connection_build=>nil, :max_redirects=>5, :raise_errors=>true, :authorize_url=>"https://accounts.google.com/o/oauth2/auth", :token_url=>"https://accounts.google.com/o/oauth2/token"}>, @token_expires_at=1325083620, @token="XXX, @redirect_uri="XXX", @refresh_token="XXX", @client_secret="XXX", @client_id="XXX", @api_version="v1", @endpoint="https://www.googleapis.com/plus", @api_key=nil>
Gplus access token: MISSING!
Oauth error: #<OAuth2::Error: OAuth2::Error>
Oauth response: #<OAuth2::Response:0x6a97a58 @error=#<OAuth2::Error: OAuth2::Error>, @parsed={"error"=>{"code"=>400, "errors"=>[{"domain"=>"global", "reason"=>"badRequest", "message"=>"Bad Request"}], "message"=>"Bad Request"}}, @response=#<Faraday::Response:0x6a97a80 @env={:response=>#<Faraday::Response:0x6a97a80 ...>, :response_headers=>{"x-content-type-options"=>"nosniff", "x-frame-options"=>"SAMEORIGIN", "expires"=>"Wed, 28 Dec 2011 14:09:57 GMT", "content-type"=>"application/json; charset=UTF-8", "connection"=>"close", "date"=>"Wed, 28 Dec 2011 14:09:57 GMT", "x-xss-protection"=>"1; mode=block", "server"=>"GSE", "cache-control"=>"private, max-age=0"}, :request_headers=>{}, :status=>400, :request=>{:proxy=>nil}, :method=>:get, :parallel_manager=>nil, :url=>#<Addressable::URI:0x355221c URI:https://www.googleapis.com/plus/v1/people/115135253293279523949?key=>, :ssl=>{}, :body=>"{\n "error": {\n "errors": [\n {\n "domain": "global",\n "reason": "badRequest",\n "message": "Bad Request"\n }\n ],\n "code": 400,\n "message": "Bad Request"\n }\n}\n"}, @on_complete_callbacks=[]>, @options={:parse=>nil}>
May be the API has changed?
Thanks,
Tamas
The text was updated successfully, but these errors were encountered: