我有一个 Java 程序与服务器通信以进行身份验证并显示正确的响应:
public class Example {
private static final String PROTECTED_RESOURCE_URL = "http://testwebsite.com/";
public static void main(String[] args)
{
OAuthService service = new ServiceBuilder()
.provider(TwoLeggedOAuth.class)
.apiKey("my_key")
.apiSecret("my_secret")
.build();
Token token = new Token("", "");
OAuthRequest request = new OAuthRequest(Verb.GET, PROTECTED_RESOURCE_URL);
service.signRequest(token, request);
Response response = request.send();
System.out.println("Response: " + response.getBody());
}
}
当集成到 Android 应用程序中时,相同的程序不起作用。
我得到消息:oAuth Verification Failed
。