Alan Peng
Alan Peng

Reputation: 31

XMPPframewok with openfire

I've setup my own Openfire server and have it tested with Spark and Adium. Though I got the following authentication error when running the sample project from XMPPFramework for iOS:

2011-11-16 01:34:26:850 iPhoneXMPP[1245:207] iPhoneXMPPAppDelegate: xmppStream:socketDidConnect:
2011-11-16 01:34:26:850 iPhoneXMPP[1245:8d0f] SEND: <stream:stream xmlns='jabber:client'  xmlns:stream='http://etherx.jabber.org/streams' version='1.0' to='flashmatch.net'>
2011-11-16 01:34:27:464 iPhoneXMPP[1245:7b13] RECV: <stream:stream  xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client" from="ip-10-112-57-167"   id="ff9c2cf2" xml:lang="en" version="1.0"/>
2011-11-16 01:34:27:772 iPhoneXMPP[1245:8d0f] RECV: <stream:features><starttls   xmlns="urn:ietf:params:xml:ns:xmpp-tls"/><mechanisms xmlns="urn:ietf:params:xml:ns:xmpp-sasl"> <mechanism>DIGEST-MD5</mechanism><mechanism>PLAIN</mechanism><mechanism>CRAM-MD5</mechanism></mechanisms><compression xmlns="http://jabber.org/features/compress"><method>zlib</method></compression><auth xmlns="http://jabber.org/features/iq-auth"/><register xmlns="http://jabber.org/features/iq-register"/></stream:features>
2011-11-16 01:34:27:772 iPhoneXMPP[1245:207] iPhoneXMPPAppDelegate: xmppStreamDidConnect:
2011-11-16 01:34:27:772 iPhoneXMPP[1245:207] SEND: <auth xmlns='urn:ietf:params:xml:ns:xmpp-sasl' mechanism='DIGEST-MD5'/>
2011-11-16 01:34:28:079 iPhoneXMPP[1245:7b13] RECV: <challenge xmlns="urn:ietf:params:xml:ns:xmpp-sasl">cmVhbG09ImlwLTEwLTExMi01Ny0xNjciLG5vbmNlPSIycWZoY01JL0R2a0Z0ME41TmNSdGpUaGk0dmVOamk4YUxHMU9LMmZwIixxb3A9ImF1dGgiLGNoYXJzZXQ9dXRmLTgsYWxnb3JpdGhtPW1kNS1zZXNz</challenge>
2011-11-16 01:34:28:079 iPhoneXMPP[1245:7b13] decoded response: username="alan",realm="ip- 10-112-57-167",nonce="2qfhcMI/DvkFt0N5NcRtjThi4veNji8aLG1OK2fp",cnonce="8C2C32EC-532A-4A75-8166-F75387CE2F84",nc=00000001,qop=auth,digest-uri="xmpp/flashmatch.net",response=8b1ad8c7c968a92d36ff6ed895b0ed80,charset=utf-8
2011-11-16 01:34:28:080 iPhoneXMPP[1245:7b13] SEND: <response xmlns="urn:ietf:params:xml:ns:xmpp-sasl">dXNlcm5hbWU9ImFsYW4iLHJlYWxtPSJpcC0xMC0xMTItNTctMTY3Iixub25jZT0iMnFmaGNNSS9EdmtGdDBONU5jUnRqVGhpNHZlTmppOGFMRzFPSzJmcCIsY25vbmNlPSI4QzJDMzJFQy01MzJBLTRBNzUtODE2Ni1GNzUzODdDRTJGODQiLG5jPTAwMDAwMDAxLHFvcD1hdXRoLGRpZ2VzdC11cmk9InhtcHAvZmxhc2htYXRjaC5uZXQiLHJlc3BvbnNlPThiMWFkOGM3Yzk2OGE5MmQzNmZmNmVkODk1YjBlZDgwLGNoYXJzZXQ9dXRmLTg=</response>
2011-11-16 01:34:28:386 iPhoneXMPP[1245:8d0f] RECV: <failure xmlns="urn:ietf:params:xml:ns:xmpp-sasl"><not-authorized/></failure>
2011-11-16 01:34:28:386 iPhoneXMPP[1245:207] iPhoneXMPPAppDelegate: xmppStream:didNotAuthenticate:

The same sample project works well when connecting to talk.google.com however. Any one knows what went wrong here?

Upvotes: 3

Views: 5176

Answers (3)

Tharindu Madushanka
Tharindu Madushanka

Reputation: 3361

You could check the openfire ServerName in admin panel.

Server Manager > Server Information > Server Name: [server_name]

Host Address / IP might be different from the one in Server Name:

[host_address]:9090/ - admin panel [server_name]

if server name is different than host address settings would be like below. In most situations server name & host address are same. so no issues in authentication with iOS xmppframework.

xmppStream.hostName = @"hostaddress";
xmppStream.hostPort = 5222;

jabberID = @"username@servername";

Upvotes: 3

Burhan Ahmad
Burhan Ahmad

Reputation: 728

When you try to login, provide user name with the ip address of server like "[email protected]"

If you are trying to login at a specified domain then add these line of code in setupStream Method

[xmppStream setHostName:@"google.com"];//domain name
[xmppStream setHostPort:5222];//port number

Upvotes: 4

Bashar Altakrouri
Bashar Altakrouri

Reputation: 10605

It is hard to guess the problem without looking that the code but the authontication problem indicates a problem in your users JIDs or passwords. So i can think of two possible problems:

  1. You should make sure that you have set your users and passwords correctly in your Openfire.
  2. Second check the "Server Name" property if it was set correctly. Go to you admin panel -> Server Information -> Server Name. This should match the domain name of your users in your iOS project. Lets look at this example: if you have your server name set to "127.0.0.1" then you should use [email protected], using YOURUSER@localhost will not work will fail in the authentication process.

Upvotes: 5

Related Questions