Problems with XMPP4R with Google Apps for your Domain account

I am having problems connecting (using the xmpp4r ruby api) to an
account on a ‘Google Apps for your Domain’ service.

I am able to connect to a standard account (using
Jabber::Simple) fine, but when I try connecting to an account on the
alternative domain (let’s call it, I have to use the non-
simple way of doing it so I can set up the JID properly, and I get an

This is the method I’m having a problem with:

11 def initialize(username)
12 @username = username
13 @email = “#{@username}
14 @password = googlepassword (googlepassword is a method that
returns the unhashed user’s password)
16 jid = JID::new(@email, “”, “Glamlife”)
17 cl = Client::new(jid)
18 cl.connect
19 cl.auth(@password)
20 end

I get this error:

Jabber::ClientAuthenticationFailure: closed stream
from /Library/Ruby/Gems/1.8/gems/xmpp4r-0.5/lib/xmpp4r/client.rb:
118:in auth' from /Users/mark/Sites/daughter/app/models/gtalk.rb:20:ininitialize’
from (irb):55:in `new’
from (irb):55
from :0

I have tried changing the cl.auth to cl.auth_nonsasl, to see if that
was the problem, and I get a different error:

IOError: closed stream
from /Library/Ruby/Gems/1.8/gems/xmpp4r-0.5/lib/xmpp4r/stream.rb:
346:in write' from /Library/Ruby/Gems/1.8/gems/xmpp4r-0.5/lib/xmpp4r/stream.rb: 346:in<<’
from /Library/Ruby/Gems/1.8/gems/xmpp4r-0.5/lib/xmpp4r/stream.rb:
346:in send_data' from /Library/Ruby/Gems/1.8/gems/xmpp4r-0.5/lib/xmpp4r/stream.rb: 344:insynchronize’
from /Library/Ruby/Gems/1.8/gems/xmpp4r-0.5/lib/xmpp4r/stream.rb:
344:in send_data' from /Library/Ruby/Gems/1.8/gems/xmpp4r-0.5/lib/xmpp4r/stream.rb: 375:insend’
from /Library/Ruby/Gems/1.8/gems/xmpp4r-0.5/lib/xmpp4r/stream.rb:
432:in send_with_id' from /Library/Ruby/Gems/1.8/gems/xmpp4r-0.5/lib/xmpp4r/client.rb: 241:inauth_nonsasl’
from /Users/mark/Sites/daughter/app/models/gtalk.rb:19:in
initialize' from (irb):62:innew’
from (irb):62
from :0

If anyone has any idea what I’m doing wrong (I don’t really understand
all the authentication stuff!) I’d be extremely grateful for any



Have you added the necessary DNS records? Detailed here:


This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs