我试图从retrieveRequestToken 路标API 获取Auth_url。它抛出 OAuthCommunicationException。当我对 twitter 使用相同的代码时(在更改消费者和提供之后),它可以正常工作。请在这里帮助我。谢谢
public class NetflixTest {
private static final long serialVersionUID = 1L;
public static final String NETFLIX_REQUEST_TOKEN_URL = "http://api.netflix.com/oauth/request_token";
public static final String NETFLIX_ACCESS_TOKEN_URL = "http://api.netflix.com/oauth/access_token";
public static final String NETFLIX_AUTHORIZE_URL = "https://api-user.netflix.com/oauth/login";
public static void main(String[] args) {
System.setProperty("debug", "1");
OAuthConsumer consumer = new DefaultOAuthConsumer("jw5pvuq766d6rf4m2pu2ft5r", "y8x3dhMFqz");
OAuthProvider provider = new DefaultOAuthProvider(NETFLIX_REQUEST_TOKEN_URL,
NETFLIX_ACCESS_TOKEN_URL, NETFLIX_AUTHORIZE_URL);
try {
String authUrl = provider.retrieveRequestToken(consumer, "http://mydomain.com/Netflix/");
System.out.println(authUrl);
} catch (OAuthMessageSignerException e) {
e.printStackTrace();
} catch (OAuthNotAuthorizedException e) {
e.printStackTrace();
} catch (OAuthExpectationFailedException e) {
e.printStackTrace();
} catch (OAuthCommunicationException e) {
e.printStackTrace();
System.out.println(e.getResponseBody());
}
}
}