robbiehanson / XMPPFramework

An XMPP Framework in Objective-C for Mac and iOS
Other
5.91k stars 2.09k forks source link

"No suitable authentication method found" error #576

Closed sunil-zalavadiya closed 9 years ago

sunil-zalavadiya commented 9 years ago

I have tried to authenticate on secured openfire server from iOS using XMPP. It's connected successfully, but it did not get authenticate and i have received following error :

Error Domain=XMPPStreamErrorDomain Code=4 "No suitable authentication method found" UserInfo=0x79726370 {NSLocalizedDescription=No suitable authentication method found}

Is there any solution for it?

ObjColumnist commented 9 years ago

Strange, what authentication methods does the server support?

They should be returned by the server, so they would be visible in the console.

sunil-zalavadiya commented 9 years ago

I don't know what to do? Should I have to make any settings on openfire?

ObjColumnist commented 9 years ago

I guess so,

Do you see any mechanisms returned by the server in a <mechanisms xmlns="urn:ietf:params:xml:ns:xmpp-sasl"> tag

sunil-zalavadiya commented 9 years ago

Can you please explain where I can find mechanisms returned by server?

ObjColumnist commented 9 years ago

In Xcode's Console, by default the entire XML Exchange with the server is outputted to the console.

sunil-zalavadiya commented 9 years ago

I have traced and received following response :

<stream:stream xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client" from="ws.test.my" id="85c8844a" stream1:lang="en" version="1.0"><stream:features xmlns:stream="http://etherx.jabber.org/streams"><starttls xmlns="urn:ietf:params:xml:ns:xmpp-tls"/><mechanisms xmlns="urn:ietf:params:xml:ns:xmpp-sasl"><mechanism>EXTERNAL</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></stream:stream>

ObjColumnist commented 9 years ago

So currently it is only advertising support for EXTERNAL, which isn't a supported Authentication Mechanism by the XMPPFramework (and is a bit of a strange one, first time I have seen it TBH).

I am guessing there is a setting on Openfire (as lots of people use it) to allow different authentication mechanisms.

bhavesh-hirpara commented 9 years ago

Delete this sasl.mechs from System Properties in openfire

sunil-zalavadiya commented 9 years ago

Yeh, It's done. Now it's working. :)

ObjColumnist commented 9 years ago

Glad you got it working :)

mmrobert commented 9 years ago

Hi, how do I trace the response for the entire XML Exchange with the server? I have the same problem "No suitable authentication method found'. Thanks a lot.

mmrobert commented 9 years ago

My program shows socket connected in "socketDidConnect" method. Thanks.

mmrobert commented 9 years ago

One more thing, xmppStream method "connectWithTimeout:error:" always return YES even server address is set to wrong, and I have to use the method "isConnected" to check if it is connected.

ObjColumnist commented 9 years ago

That's expected, connectWithTimeout:error: returns YES if the stream will attempt to connect i.e. It's is correctly configured. You need to implement the various XMPPStream delegate methods to be informed about when the stream authenticates.

mmrobert commented 9 years ago

If as you said, there is no need to check "if(![self.xmppStream connectWithTimeout:XMPPStreamTimeoutNone error:&error]), and the UIAlertView will never be shown, in the "connect" method in the github standard example, how to explain this, the example is wrong?

Thanks a lot.

mmrobert commented 9 years ago

Hi, would you please also tell me how do I trace the response for the entire XML Exchange with the server? I have the same problem "No suitable authentication method found'. Thanks a lot.

mloupe commented 6 years ago

Hey I just wanted to add that I had the same problem: "No suitable authentication method found" using Prosody as the XMPP server.

What solved the problem for me was forcing TLS to use the server's certificate: self.xmppStream.startTLSPolicy = .required