我的消费者代码如下,
GoogleOAuthParameters oauthParameters = new GoogleOAuthParameters();
oauthParameters.setOAuthConsumerKey(CONSUMER_KEY);
oauthParameters.setOAuthConsumerSecret(CONSUMER_SECRET);
oauthParameters.setOAuthType(OAuthType.TWO_LEGGED_OAUTH);
OAuthHmacSha1Signer signer = new OAuthHmacSha1Signer();
GoogleService service = new GoogleService("oauthclient", "sampleapp");
service.setOAuthCredentials(oauthParameters, signer);
String param = "Hellow World";
String baseString = APP_SERVER + "services/OAuthTest/greet"+"?xoauth_requestor_id="+USER_NAME+"&name="+ param;
URL feedUrl = new URL(baseString);
request = service.createFeedRequest(feedUrl);
request.execute();
convertStreamToString(request.getResponseStream());
而我的 OAuth 服务器端代码如下,
GoogleOAuthParameters oauthParameters = new GoogleOAuthParameters();
oauthParameters.setOAuthConsumerKey(consumerKey);
oauthParameters.setOAuthConsumerSecret(secretKey);
oauthParameters.setOAuthNonce(nonce);
oauthParameters.setOAuthTimestamp(timestamp);
oauthParameters.setOAuthSignatureMethod(signatureMethod);
validateTimestampAndNonce(otimestamp, nonce);
OAuthHmacSha1Signer signer = new OAuthHmacSha1Signer();
String baseString = OAuthUtil.getSignatureBaseString(baseUrl,httpMethod, baseParameters);
String signature = signer.getSignature(baseString, oauthParameters);
return signature.equals(oauthParams.getOauthSignature())
以上签名验证失败,我不知道出了什么问题。请帮忙。