I have to support Google OAuth 2 login in my project. I added this API to the apis, and there are some additional changes too. First of all the grant_type is a required parameter in OAuth 2, so it could be set via API objects yet. The Google API requires some changes in request parameter handling, because they wanna use POST instead of GET. So I merged body parameters and querystring parameters, and only the Verb defines the request method. The Google access_token answer contains whitespaces between the name and the colon - I changed the regex pattern of JsonTokenExtractor to tolerate this.
Please, check my changes, and if you find them useful, then pull it back please in the main project. I tested the new version against Facebook, Live and Google via OAuth 2 interfaces.
Thanks for this great library!
Add grant_type request parameter to APIs based on OAuth 2.
Fix access_token pattern to support whitespaces between access_token …
…string and colon.
Remove unused imports and variables.
We can set up request method via Verb, so no different body and query…
… parameters required. I removed the body parameters and replaced with query parameters. This is necessary for Google OAuth 2 POST support.
New Google OAuth 2 API.
I wrote a patch myself for Oauth 2 and sent it to pablo right before xmas. Code looks pretty identical. guess i should have made a pull request like you so it would have been publicly available. sorry for that :)
Will this make it into Scribe?
It would be nice if this functionality make its way into scribe.
For you guys who want it before it gets included into scribe, I wrote a version that is self contained and requires no modification to the library (so you can include it in your project now). This doesn't handle the "state" parameter, because it's optional and requires, well, state. In my app, it's handled outside the library.
Wrote it w/o looking at Isolova's version. Ideally, the library itself should be updated to take into account the current state of the OAuth 2.0 spec (v25), such as the "grant_type" parameter which is required to be "authorization_code" for the authorization code grant flow (4.1.3), and handling the POST verb for the access token request. See my extension of OAuth20ServiceImpl at the bottom of the gist.
I've taken the Google2Api code from yincrash, and tried to retrieve the Google Contacts with it, but I always get an error 401 like 'There was an error in your request'. Has anyone been able to make the Google Contacts work? I was trying to access https://www.google.com/m8/feeds/contacts/default/full with my freshly retrieve oauth 2.0 tokens, but no luck. I've also been trying using the gdata library but I have a 'No authentication header information'.
Note: I have tried the same things by using the GoogleApi instead and it works, these errors only appear with oauth 2.0
a method that's named getByteBodyContents uses query-string params? I don't think that's what it's intended to do? Does it break any of the gazillion other apis that scribe supports?
@mebibou I was able to retrieve Google Contacts using the code provided by @yincrash
Is there a reason this was closed and not merged yet? I'd really like to see it in Scribe.
I closed most tickets today, here's the reason:
Pity. At least I will learn github forking.