Hello, i am trying to develop a yahoo messenger client for Android. I made the first request for the request token and i have the response .
The RequestToken i get it by sending the username, password and my consumer key.
I don't know very well what to do next... , as i seen in this forum the next step should be the Session Request.
I have this code:
CODE
java.util.Date today = new java.util.Date(); // get the timestamp
long timeStamp = today.getTime();
String sessionUrl = "http://api.login.yahoo.com/v1/session" +
"?oauth_consumer_key=" + "MY KEY IS HERE" +
"&oauth_nonce=" + "24829.2331" +
"&oauth_signature=" + "MY CONSUMER SECRET KEY IS HERE" + "%26" + text.replace("RequestToken=", "") + // here i get the Request token
"&oauth_signature_method=PLAINTEXT" +
"&oauth_timestamp=" + timeStamp +
"&oauth_token=" + text.replace("RequestToken=", "") + // here i get the Request token again
"&oauth_version=1.0" +
"¬ifyServerToken=1";
URL urlSession = null;
try {
urlSession = new URL(sessionUrl);
} catch (MalformedURLException ex) {
Log.e("MalformedURLException 1", "" + ex);
}
HttpURLConnection connSes = null;
try {
connSes = (HttpURLConnection) urlSession.openConnection();
} catch (IOException ex) {
Log.e("IOException 1", "" + ex);
}
try {
connSes.setRequestMethod("GET");
} catch (ProtocolException ex) {
Log.e("ProtocolException 1", "" + ex);
}
try {
connSes.connect();
} catch (IOException ex) {
Log.e("IOException 2", "" + ex);
}
InputStream inSess = null;
try {
inSess = connSes.getInputStream();
} catch (IOException ex) {
Log.e("IOException 3", "" + ex);
}
BufferedReader readerSess = new BufferedReader(new InputStreamReader(inSess));
String textSess = "";
try {
textSess = readerSess.readLine();
} catch (IOException ex) {
Log.e("IOException 4", "" + ex);
}
connSes.disconnect();
if (textSess == null){
txt.append("\n " + textSess.charAt(1));
}else {
txt.append("\n NULL");
}
With this code i am getting an null pointer error when i am trying to print the response.
I think that my request is not to good or i am not doing the correct request.
Can anyone help me please, i have read
http://developer.yahoo.com/messenger/guide/index.html but i can't understand to much the order of the requests and how to make them.
Thank you very much !