After a successful connection to the server, i.e. after a successful callback to
- (void) xmppStreamDidConnect:(XMPPStream *)sender
Sometimes I get an authentication error, i.e. the following callback is called:
- (void) xmppStream: (XMPPStream *) sender didNotAuthenticate: (NSXMLElement *) error
NSXMLElement as follows:
<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>
As I said, I get this from time to time. I traced this issue, and so far I have tried several things. Things I learned, and I can confirm so far:
- Username and password are 100% correct.
- I use SCRAM-SHA-1 authentication mechanism (
XMPPSCRAMSHA1Authentication ) - My server also supports the PLAIN mechanism, and it also does not work (
XMPPPlainAuthentication ) - If I try to disconnect when I get this error (
[xmppStream disconnect] ) and then in the xmppStreamDidDisconnect I try to reopen the stream ( [xmppStream connectWithTimeout:XMPPStreamTimeoutNone error:&error] ), then I get into an infinite loop because the check authenticity ends sequentially
Now I have studied this even more, and using the SCRAM-SHA-1 mechanism, it looks like it is failing in the second call. The client sends something (seemingly valid) to the server, but it does not like the server and gives an not-authorized error.
Anyone's thoughts?
source share