那么有似乎对这个话题比较严重的混乱过期的访问令牌,我挣扎着爬了明确的答案,所以这里是我的问题...刷新使用服务器端的流量自动
我现在用的是我之前使用offline_access这是现在正在折旧,所以我需要一种刷新令牌的方式在以下情况:
1)用户更改FB密码 2)令牌自然到期
我的应用程序发布结果给用户FB墙壁,所以刷新需要是d一个自动我们的服务器(无cookie或OAuth的对话框)
我想我可以尝试使用新的端点这里
http://developers.facebook.com/roadmap/offline-access-removal/
描述,用下面的一段代码(JAVA):
public static String refreshFBAccessToken(String existingAccessToken)
throws Exception{
//Currently not working
String refreshUrl = "https://graph.facebook.com/oauth/access_token?
client_id="+FacebookApp.appId+"
&client_secret="+FacebookApp.appSecret+"
&grant_type=fb_exchange_token
&fb_exchange_token="+existingAccessToken;
URL url = new URL(refreshUrl);
URI uri = new URI(url.getProtocol(), url.getHost(), url.getPath(),
url.getQuery(), null);
String result = readURL(uri.toURL());
String[] resultSplited = result.split("&");
return resultSplited[0].split("=")[1];
}
但这似乎没有工作(我得到回应400),当我重读看来这个端点用于仅使用客户端的流量获得令牌的文档...
那么服务器端的流量怎么样....?
有人可以告诉我,如果上述方法是正确的或有另一种方式?
非常感谢
好的,谢谢,那不是我想听的,但很高兴知道!我想我会发送一封自动发送的电子邮件,要求他们点击刷新令牌的链接 – DaveB 2012-04-16 12:32:26