Re: [prosody-users] Connecting to prosody through XMPPHP - Authentication fails

696 views
Skip to first unread message

Florian Zeitz

unread,
Aug 23, 2012, 8:48:06 AM8/23/12
to prosod...@googlegroups.com
Am 23.08.2012 13:52, schrieb Dragos Andronic:
> I'm migrating from openfire to prosody to take advantage of the CORS
> support.
>
> I've configured prosody (see the attached config file) and tested the
> server by connecting with some xmpp clients (gajim, pandion) and it
> works ok.
> Connecting via strophe via BOSH also works.
>
> Now I'm trying to connect via XMPPHP from a php running on the same machine:
> $conn = new XMPPHP_XMPP('176.34.122.100', 5222, 'myuser','mypassword',
> 'xmpphp', 'txtfeedback.net');
> $conn->connect();
> $conn->processUntil('session_start');
>
> and whatever combination I try I end up with
> Fatal error: Uncaught exception 'XMPPHP_Exception' with message 'Auth
> failed!' in /var/www/html/sms/XMPPHP/XMPP.php:
>
> Connecting with the same user/credentials from other IM clients works
> just fine.
> Any ideas of what may be wrong?
>
Hello,

If it really fails with "whatever combination" that is strange, but from
a casual reading of XMPPPHP's source, I think you just put the IP and
the domain in the wrong arguments. I.e. the call should be:
$conn = new XMPPHP_XMPP('txtfeedback.net', 5222, 'myuser','mypassword',
'xmpphp', '176.34.122.100');

Regards,
Florian

Florian Zeitz

unread,
Aug 23, 2012, 9:50:21 PM8/23/12
to prosod...@googlegroups.com
So... you did at least try, right?

Because, unless you are using a version of XMPPPHP very different from
what I can find online the first parameter is definitely the service
name of the server to connect to, while the 6th is the actual address.
That this worked with Openfire is not an argument at all, they may
conceivably handle virtual hosts very differently than Prosody.

Am 23.08.2012 21:42, schrieb Dragos Andronic:
> The order of the parameters is correct - the first parameter is the
> ip/address of the server.
> I've been using a similar syntax for connecting to the Openfire server:
> $conn = new XMPPHP_XMPP('176.34.122.100', 5222,
> 'myuser@mydomain','mypassword', 'xmpphp')
> and everything worked.
>
> Any other ideas?
>
> On Thursday, August 23, 2012 3:48:06 PM UTC+3, Florian Zeitz wrote:
>
> Am 23.08.2012 13:52, schrieb Dragos Andronic:
> > I'm migrating from openfire to prosody to take advantage of the CORS
> > support.
> >
> > I've configured prosody (see the attached config file) and tested the
> > server by connecting with some xmpp clients (gajim, pandion) and it
> > works ok.
> > Connecting via strophe via BOSH also works.
> >
> > Now I'm trying to connect via XMPPHP from a php running on the
> same machine:
> > $conn = new XMPPHP_XMPP('176.34.122.100', 5222,
> 'myuser','mypassword',
> > 'xmpphp', 'txtfeedback.net <http://txtfeedback.net>');
> > $conn->connect();
> > $conn->processUntil('session_start');
> >
> > and whatever combination I try I end up with
> > Fatal error: Uncaught exception 'XMPPHP_Exception' with message 'Auth
> > failed!' in /var/www/html/sms/XMPPHP/XMPP.php:
> >
> > Connecting with the same user/credentials from other IM clients works
> > just fine.
> > Any ideas of what may be wrong?
> >
> Hello,
>
> If it really fails with "whatever combination" that is strange, but
> from
> a casual reading of XMPPPHP's source, I think you just put the IP and
> the domain in the wrong arguments. I.e. the call should be:
> $conn = new XMPPHP_XMPP('txtfeedback.net <http://txtfeedback.net>',
> 5222, 'myuser','mypassword',
> 'xmpphp', '176.34.122.100');
>
> Regards,
> Florian
>
> --
> You received this message because you are subscribed to the Google
> Groups "Prosody IM Users" group.
> To view this discussion on the web, visit
> https://groups.google.com/d/msg/prosody-users/-/8R7dziZFA94J.
> To post to this group, send an email to prosod...@googlegroups.com.
> To unsubscribe from this group, send email to
> prosody-user...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/prosody-users?hl=en-GB.

Kim Alvefur

unread,
Aug 23, 2012, 9:38:38 PM8/23/12
to prosod...@googlegroups.com
On 2012-08-23T21:42:27 CEST, Dragos Andronic wrote:
> The order of the parameters is correct - the first parameter is the
> ip/address of the server.
> I've been using a similar syntax for connecting to the Openfire server:
> $conn = new XMPPHP_XMPP('176.34.122.100', 5222,
> 'myuser@mydomain','mypassword', 'xmpphp')
> and everything worked.

Actually, it's not. The first name is the hostname to connect to. If
this is different from the domain you want to talk to, you add that
after. If you follow the code, the first parameter is called $host and
the later is called $server. $server is set to $host if it is null, and
it then builds the stream header like '<stream:stream ... to="$server"
....>'.

Regards,
Kim

signature.asc

Kim Alvefur

unread,
Aug 23, 2012, 9:46:29 PM8/23/12
to prosod...@googlegroups.com
Sorry, last post may have been meant as a reply to what Florian wrote.

Anyways, this is what I looked at earlier:
https://github.com/heidisoft/XMPPHP/blob/master/XMPPHP/XMPP.php#L116

signature.asc

Matthew Wild

unread,
Aug 26, 2012, 6:46:43 PM8/26/12
to prosod...@googlegroups.com, za...@zash.se
Hi Dragos,

On 24 August 2012 11:48, Dragos Andronic <dragos....@gmail.com> wrote:
> I've nailed down the problem:

Excellent!

> The default XMPPHP_XMPP implementation encodes the authentication
> information as PLAIN data (PLAIN mechanism).
> Openfire can work with this, while prosody only knows SCRAM-SHA-1 and
> DIGEST-MD5.

Small correction - Prosody does support PLAIN. However by default
Prosody will not allow it on unencrypted connections. I guess this
means your connection from XMPPHP is not encrypted, just so you know.

Regards,
Matthew
Reply all
Reply to author
Forward
0 new messages