# Problems with XMPP4R with Google Apps for your Domain account

**URL:** <https://www.ruby-forum.com/t/problems-with-xmpp4r-with-google-apps-for-your-domain-account/196992>\
**Category:** Ruby\
**Created:** [September 3, 2009, 10:24am UTC](https://www.ruby-forum.com/t/problems-with-xmpp4r-with-google-apps-for-your-domain-account/196992 "2009-09-03T10:24:46Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![mark](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/e9c0ed/32.png) [@mark](https://www.ruby-forum.com/u/mark)\
**Post date:** [September 3, 2009, 10:24am UTC](https://www.ruby-forum.com/t/problems-with-xmpp4r-with-google-apps-for-your-domain-account/196992/1 "2009-09-03T10:24:46Z")

</div>

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 [gmail.com](http://gmail.com) account (using  
Jabber::Simple) fine, but when I try connecting to an account on the  
alternative domain (let’s call it [domain.com](http://domain.com)), I have to use the non-  
simple way of doing it so I can set up the JID properly, and I get an  
error.

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

11 def initialize(username)  
12 @username = username  
13 @email = “#{@username}@glam.ac.uk”  
14 @password = googlepassword (googlepassword is a method that  
returns the unhashed user’s password)  
15  
16 jid = JID::new(@email, “[talk.google.com](http://talk.google.com)”, “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:in `initialize’  
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:in `synchronize’  
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:in `send’  
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:in `auth\_nonsasl’  
from /Users/mark/Sites/daughter/app/models/gtalk.rb:19:in  
`initialize' from (irb):62:in `new’  
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  
pointers.

Thanks,

Mark

---

<div class="post-metadata">

**Author:** ![mark](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/e9c0ed/32.png) [@mark](https://www.ruby-forum.com/u/mark)\
**Post date:** [September 3, 2009, 9:51pm UTC](https://www.ruby-forum.com/t/problems-with-xmpp4r-with-google-apps-for-your-domain-account/196992/2 "2009-09-03T21:51:36Z")

</div>

Have you added the necessary DNS records? Detailed here:

> **[Manage Meet settings (for admins) - Google Workspace Admin Help](https://support.google.com/a/answer/7304109?hl=en&visit_id=638237884801851772-2410742797&rd=1)**
>
> Feature availability depends on your edition.  Compare your edition

MJS
