Monday, March 3, 2014

Neighborhoods: abnormal questions about the certification application watercress Oauth


Watercress brother wanted to develop a client can apply for certification testing oauth time that they have to return to an address, and then took the browser to this address certification, certification can always return the exception message, the address is Null, Why do follow video will go wrong. Tune a day, to help expert advice should be grateful.

Test code is as follows:
public class DoubanDemo {

public static void main (String [] args) {
String apiKey = "078ceaae662c2dce16a6c00b3284896a";
String secret = "68c9a5faa2192952";

DoubanService myService = new DoubanService ("stephen small watercress", apiKey,
secret);

System.out.println ("please paste the url in your webbrowser,"
+ "Complete the authorization then come back:");
System.out.println (myService.getAuthorizationUrl (null));
byte buffer [] = new byte [1];
try {
System.in.read (buffer);
} Catch (IOException e) {
e.printStackTrace ();
}
ArrayList tokens = myService.getAccessToken ();
System.out.println (tokens.get (0));
System.out.println (tokens.get (1));

}
}
The result is as follows:
please paste the url in your webbrowser, complete the authorization then come back:
null
net.oauth.OAuthProblemException
at net.oauth.client.OAuthHttpClient.invoke (OAuthHttpClient.java: 71)
at net.oauth.client.OAuthClient.invoke (OAuthClient.java: 96)
at net.oauth.client.OAuthClient.getRequestToken (OAuthClient.java: 67)
at net.oauth.client.OAuthClient.getRequestToken (OAuthClient.java: 82)
at com.google.gdata.client.douban.DoubanService.getAuthorizationUrl (Unknown Source)
at appdemo.DoubanDemo.main (DoubanDemo.java: 43)<-! Main posts under Banner (D4) -><-! Posts under the main text (D5) ->

No comments:

Post a Comment