4

由于facebook现在停止了离线访问,我如何存储/获取新的访问令牌。我已经尝试了很多。代码如下。我必须在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");
            }

如何兑换代币??请帮忙。

4

1 回答 1

2

为什么不使用Android 版 Facebook SDK

于 2012-07-12T12:21:56.457 回答