File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change
1
+ ------
2
+ Async Http Client - Using OAuth
3
+ ------
4
+ Jeanfrancois Arcand
5
+ ------
6
+ 2012
7
+
8
+ Using OAuth
9
+
10
+ You can use the library to pull data from any OAuth site (like Twitter). This is as simple as:
11
+
12
+ +-----+
13
+ private static final String CONSUMER_KEY = "dpf43f3p2l4k3l03";
14
+ private static final String CONSUMER_SECRET = "kd94hf93k423k f44";
15
+ public static final String TOKEN_KEY = "nnch734d00sl2jdk";
16
+ public static final String TOKEN_SECRET = "pfkkdhi9sl3r4s00";
17
+ public static final String NONCE = "kllo9940pd9333jh";
18
+ final static long TIMESTAMP = 1191242096;
19
+
20
+ public void oAuth() {
21
+ ConsumerKey consumer = new ConsumerKey(CONSUMER_KEY, CONSUMER_SECRET);
22
+ RequestToken user = new RequestToken(TOKEN_KEY, TOKEN_SECRET);
23
+ OAuthSignatureCalculator calc = new OAuthSignatureCalculator(consumer, user);
24
+ AsyncHttpClient client = new AsyncHttpClient();
25
+ Response response = client.prepareGet("http://...").setSignatureCalculator(calc).execute().get();
26
+ +-----+
You can’t perform that action at this time.
0 commit comments