我想在android上构建一个XMPP客户端,我已经使用Digest-MD-5让它运行得很完美,但是当我试图将它转换到X-FACEBOOK-PLATFORM时,它总是失败。
发布于 2011-01-06 20:29:51
因此,基本上X-FACEBOOK-PLATFORM身份验证只使用了访问令牌的一部分。这称为会话密钥。
访问令牌是由"|“字符分隔的,因此您可以拆分访问令牌,只取中间的字符。请参阅以下内容。
******|a681464febcefb8__*-**|__******
long callId = new GregorianCalendar().getTimeInMillis() / 1000L;
String sig = "api_key=" + apiKey
+ "call_id=" + callId
+ "method=" + method
+ "nonce=" + nonce
+ "session_key=" + sessionKey
+ "v=" + version
+ appSecret;
try {
sig = MD5(sig);
}
catch (NoSuchAlgorithmException e) {
throw new IllegalStateException(e);
}
String composedResponse = "api_key=" + URLEncoder.encode(apiKey, "utf-8")
+ "&call_id=" + callId
+ "&method=" + URLEncoder.encode(method, "utf-8")
+ "&nonce=" + URLEncoder.encode(nonce, "utf-8")
+ "&session_key=" + URLEncoder.encode(sessionKey, "utf-8")
+ "&v=" + URLEncoder.encode(version, "utf-8")
+ "&sig=" + URLEncoder.encode(sig, "utf-8");发布于 2011-04-03 06:24:50
我从来没有让FB chat与我的appSecret一起工作,而是使用了sessionSecret。您可以使用旧的REST API获取它。
http://developers.facebook.com/docs/reference/rest/auth.promoteSession/
这样你就可以保密你的appSecret了。此外,值得注意的是,X-FACEBOOK-PLATFORM身份验证很少会在第一次尝试时成功,但通常需要3-6次重试。我不明白为什么,因为我使用相同的会话密钥和密钥..
https://stackoverflow.com/questions/3709505
复制相似问题