我正在尝试制作一个 facebook 聊天应用程序。
我想通过 X-FACEBOOK-PLATFORM 机制登录到 XMPP 服务器。
但是当我获得身份验证步骤时失败了。
如果我使用 DIGEST-MD5 机制,我可以成功登录到 XMPP 服务器。(在这种情况下,我使用 JID 作为 username@chat.facebook.com 和 Password 作为我的 facebook 密码)
对于 X-FACEBOOK-PLATFORM 机制,我使用 JID作为 uid@chat.facebook.com,获取我的访问令牌、uid、到期日期等没有问题。
当然,我从 facebook 获得了“xmpp_login”许可。
什么问题?
这是解码的日志消息。
AppDelegate: xmppStream:socketDidConnect:
SEND: <?xml version='1.0'?>
SEND: <stream:stream xmlns='jabber:client' xmlns:stream='http://etherx.jabber.org/streams' version='1.0' to='chat.facebook.com'>
RECV: <stream:stream xmlns="jabber:client" xmlns:stream="http://etherx.jabber.org/streams" id="FAA1CDE5" from="chat.facebook.com" version="1.0" stream1:lang="en"/>
RECV: <stream:features xmlns:stream="http://etherx.jabber.org/streams"><starttls xmlns="urn:ietf:params:xml:ns:xmpp-tls"/><mechanisms xmlns="urn:ietf:params:xml:ns:xmpp-sasl"><mechanism>X-FACEBOOK-PLATFORM</mechanism><mechanism>DIGEST-MD5</mechanism></mechanisms></stream:features>
SEND: <auth xmlns='urn:ietf:params:xml:ns:xmpp-sasl' mechanism='X-FACEBOOK-PLATFORM'/>
XMPPCapabilities: My capabilities:
<query xmlns="http://jabber.org/protocol/disco#info">
<feature var="http://jabber.org/protocol/disco#info"/>
<feature var="http://jabber.org/protocol/caps"/>
</query>
RECV: <challenge xmlns="urn:ietf:params:xml:ns:xmpp-sasl">
version=1&method=auth.xmpp_login&nonce=0E51AA2E42C4AF8FCE9D996F347C7019</challenge>
SEND: <response xmlns="urn:ietf:params:xml:ns:xmpp-sasl">
method=auth.xmpp_login&nonce=0E51AA2E42C4AF8FCE9D996F347C7019&access_token=BAAEctIrR99oBAM9ZBymJSDmVZAYb82RX634ANVZCQ9VJeoD9ZCTqSGVyuxSQfbm9s92VGtwcewVJlP7C8CnIglkqZBCvq6ZBxxWhJoDmK0rPJGdM5i7KRu18bZAJoyKEI0ZD
&api_key=313036725417946
&call_id=150701328
&v=1.0</response>
RECV: <failure xmlns="urn:ietf:params:xml:ns:xmpp-sasl"><not-authorized/></failure>
AppDelegate: xmppStream:didNotAuthenticate:
AppDelegate: xmppStreamDidDisconnect:withError: