【问题标题】:Facebook Access Token storing in android appFacebook 访问令牌存储在 android 应用程序中
【发布时间】:2012-06-04 17:12:30
【问题描述】:

由于 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");
            }

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

【问题讨论】:

  • 你得到什么结果????请在此处打印。
  • 我刚刚收到 oath 异常错误。没有别的。我认为访问令牌需要保存在它过期的其他地方。感谢您的帮助
  • 嘿,我在问你在“结果”变量中得到了什么?请使用 "Log.d("Result-->",""+result);" 打印并在此处复制过去。你可以在 Logcat 中看到这个。

标签: android facebook facebook-graph-api access-token


【解决方案1】:

你为什么不使用Facebook SDK for Android

【讨论】:

    猜你喜欢
    • 2012-04-12
    • 1970-01-01
    • 2011-09-06
    • 1970-01-01
    • 2017-01-10
    • 1970-01-01
    • 2013-08-22
    • 2016-01-18
    • 2014-03-10
    相关资源
    最近更新 更多