Openfire and Net::XMPP
I was writing a perl script the other day which connects to my [Openfire XMPP server](http://www.igniterealtime.org/projects/openfire/index.jsp) and does some stuff (listening for incoming messages, etc.).
When I started my perl script it always failed with the error message:
ERROR: Authorization failed: error - not-authorized
After re-checking the password and username it still didn't want to work.
In the end [I found out](http://www.igniterealtime.org/community/thread/20551) that the the perl [Net::XMPP](http://search.cpan.org/~hacker/Net-XMPP-1.02/lib/Net/XMPP.pm) SASL authorization doesn't want to play with the SASL implementation in Openfire.
Modifying the Protocol.pm of Net::XMPP can help to solve this problem.
Open this file and comment out these lines (at line ~1800):
if($self->{STREAM}->GetStreamFeature($self->GetStreamID(),"xmpp-sasl"))
{
return $self->AuthSASL(%args);
}
After this little tweak Net::XMPP should talk to Openfire without grumbling.
December 9th, 2008 - 02:34
Works perfectly. Thanks for the post.
May 13th, 2009 - 23:25
You can better call AuthIQAuth in your code directly, instead of modifying the Perl code. Same result, but nicer solution.
May 14th, 2009 - 08:25
@Maarten: Thanks for the hint!
June 17th, 2009 - 19:29
Do you have an example code of what you have done?
June 17th, 2009 - 19:40
No, unfortunately, I don’t have this code anymore. But the only thing you have to do is to comment out the above shown lines.
June 19th, 2009 - 11:17
A working demo can be found here.
http://www.particleflux.co.uk/scripts/openfire_jabber_cl.pl.txt
If you find any other scripts on the net you can probably get them working by changing the connect line where you see AuthSend.
so
$connection->AuthSend(
becomes
$connection->AuthIQAuth(
Good luck!
October 21st, 2009 - 08:36
Hi there…
Despite all tries I’ve made, I can’t send a message with your script Gerric (nor with any other scripts I tried) : I reach a 503 error on jabber.org (I’m sure of my credentials, the port number, etc).
I already tried to comment the AuthSASL in /usr/share/perl5/XMPP/Protocol.pm and I obtain the following message :
instead of the following one :
Does anybody have a trouble like this ?
Any clue ?