0

我正在用 Java 构建一个需要 OAuth 身份验证的 twitter 应用程序,并且我正在尝试将 HttpClient 4.2.1 用于 ReST 事务。有没有人有关于如何设置 OAuth 身份验证凭据的代码示例,包括消费者密钥等?

例如基本身份验证:

client.getCredentialsProvider().setCredentials(
                new AuthScope("twitter.com", 80, AuthScope.ANY_REALM), 
                new UsernamePasswordCredentials("username", "password"));

干杯!

4

2 回答 2

0

你看过Twitter4J吗?它应该做你需要的一切,所以你可以按原样使用它或作为一个例子。

于 2012-08-30T17:12:30.063 回答
0

You can use scribe. It's documentation is detailed and lists other Apis you can access.

于 2014-10-08T12:25:14.530 回答