小编ida*_*ali的帖子

身份验证失败错误 - XMPPFramework - 未授权

成功连接到服务器后,即.成功回拨后

- (void) xmppStreamDidConnect:(XMPPStream *)sender

我有时会遇到身份验证失败,即.调用以下回调:

  • (void)xmppStream:(XMPPStream*)sender didNotAuthenticate:(NSXMLElement*)错误

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错误.

想什么?

xmpp objective-c ios xmppframework

6
推荐指数
1
解决办法
1436
查看次数

标签 统计

ios ×1

objective-c ×1

xmpp ×1

xmppframework ×1