Using OAuth with Scribe-Java and Google Apps
I'm trying to get a list of all contacts within my Google Apps domain.
To do so I'm using the Scribe-Java library (http://github.com/fernandezpablo85/scribe-java) within my GWT application.
String resp= "";
OAuthService service= new ServiceBuilder ()
.provider (GoogleApi.class).apiKey ("my-domain.com").apiSecret ("my-secret").scope (
"http://www.google.com/m8/feeds/profiles/domain/my-domain.com/full")
.build ();
Token requestToken= service.getRequestToken ();
resp= requestToken.getToken ();
This code however generates the following error:
org.scribe.exceptions.OAuthException: Could not find request token or secret in response: signature_invalid
base_string:POST&https%3A%2F%2Fwww.google.com%2Faccounts%2FOAuthGetRequestToken&oauth_callback%3Doob%26oauth_consumer_key%3Dmy-domain.com%26oauth_nonce%3D-714356546%26oauth_signature_method%3DHMAC-SHA1%26oauth_timestamp%3D1288255870%26oauth_version%3D1.0%26scope%3Dhttp%253A%252F%252Fwww.google.com%252Fm8%252Ffeeds%252Fprofiles%252Fdomain%252Fmy-domain.com%252Ffull
Any ideas what I'm doing wrong?
I got the apiKey开发者_开发技巧 and apiSecret from the Settings-page of my Google Apps domain.
It was a bug in Scribe.
Have a look over here for the issue:
https://github.com/fernandezpablo85/scribe-java/issues#issue/33
My GWT GData OAuth Demo: http://code.google.com/p/gwt-examples/wiki/DemoGwtGData
精彩评论