I have a Java program communicating with a server for authentication and displaying the correct response:
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());
}
}
The same program does not work when integrated into an Android application.
I get the message: oAuth Verification Failed
.
I was trying it with android version 2.2, when I tried with 2.3 it started working.