Sharad
Sharad

Reputation: 31

Response decoding failed with xmpp sasl authentication

I am trying complete the SASL authentication in XMPP server.

:gen_tcp.send(socket, "<auth xmlns='urn:ietf:params:xml:ns:xmpp-sasl' mechanism='PLAIN'>dGVzdDQ=</auth>")

But the server is giving error "<failure xmlns='urn:ietf:params:xml:ns:xmpp-sasl'><bad-protocol/><text xml:lang='en'>Response decoding failed</text></failure>"

Note: I also tried to send :base64.encode_to_string(' test4 123') to server

Upvotes: 0

Views: 504

Answers (1)

legoscia
legoscia

Reputation: 41648

As per RFC 4616, you need to put a NUL character before the username and the password. Try this:

iex(1)> :base64.encode_to_string([0] ++ 'test4' ++ [0] ++ '123')
'AHRlc3Q0ADEyMw=='

Upvotes: 1

Related Questions