Since the offline access is stopped by facebook now, how do I store/get a new access token. I have tried a lot. The code is below. I have to give the access token in https://graph.facebook.com/me/friends?access_token=
String url = "https://graph.facebook.com/oauth/access_token?client_id=appid&client_secret=secretid&grant_type=fb_exchange_token&fb_exchange_token=access_token";
HttpClient httpclient = new DefaultHttpClient();
HttpGet httpget = new HttpGet(url);
try{
HttpResponse response = httpclient.execute(httpget);
HttpEntity entity = response.getEntity();
is = entity.getContent();
BufferedReader reader = new BufferedReader(new InputStreamReader(is,"iso-8859-1"),8);
StringBuilder sb = new StringBuilder();
String line = null;
while ((line = reader.readLine()) != null) {
sb.append(line + "\n");
}
is.close();
result=sb.toString();
result = result.split("=")[1];
AppLog.logger(result);
}
catch(Exception e)
{
AppLog.logger("Error in JSON");
}
How to exchange token?? Please help.