【发布时间】:2014-12-28 07:58:42
【问题描述】:
成功连接服务器后,即。成功回调后
- (void) xmppStreamDidConnect:(XMPPStream *)sender
我有时会遇到身份验证失败,即。调用以下回调:
- (void) xmppStream:(XMPPStream *)sender didNotAuthenticate:(NSXMLElement *)error
NSXMLElement 看起来像这样:
<failure xmlns="urn:ietf:params:xml:ns:xmpp-sasl"><not-authorized/><text>The response provided by the client doesn't match the one we calculated.</text></failure>
就像我说的,我偶尔会得到这个。我已经追踪了这个问题,到目前为止我已经尝试了几件事。 到目前为止,我已经调查过并且可以确认的事情:
- 用户名和密码100%正确
- 我正在使用 SCRAM-SHA-1 身份验证机制 (
XMPPSCRAMSHA1Authentication) - 我的服务器也支持 PLAIN 机制,但它也失败了 (
XMPPPlainAuthentication) - 如果我在收到此错误 (
[xmppStream disconnect]) 时尝试强制断开连接,然后在xmppStreamDidDisconnect回调中尝试重新打开流 ([xmppStream connectWithTimeout:XMPPStreamTimeoutNone error:&error]),然后我会进入无限循环,因为身份验证始终失败
现在,我进一步研究了这一点,当使用 SCRAM-SHA-1 机制时,它似乎在第二个挑战中失败了。客户端向服务器发送一些东西(看似有效),但服务器不喜欢它并抛出 not-authorized 错误。
有人想吗?
【问题讨论】:
-
你有没有找到任何解决方案我也面临同样的问题。
标签: ios objective-c xmpp xmppframework