Problems with XMPP4R with Google Apps for your Domain account

Discussion in 'Ruby' started by Mark, Sep 3, 2009.

  1. Mark

    Mark Guest

    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 account (using
    Jabber::Simple) fine, but when I try connecting to an account on the
    alternative domain (let's call it 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", "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
     
    Mark, Sep 3, 2009
    #1
    1. Advertising

  2. Have you added the necessary DNS records? Detailed here:
    http://www.google.com/support/a/bin/answer.py?hl=en&answer=34143

    MJS


    On 3 Sep 2009, at 09:16, Mark wrote:

    > 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 account (using
    > Jabber::Simple) fine, but when I try connecting to an account on the
    > alternative domain (let's call it 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", "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
    >
     
    Matthew Slater, Sep 3, 2009
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?Vml2ZWs=?=
    Replies:
    0
    Views:
    290
    =?Utf-8?B?Vml2ZWs=?=
    Oct 31, 2006
  2. Replies:
    1
    Views:
    287
  3. Danielle Roach

    How do I Configure .Net V2 to use a domain account for all my apps

    Danielle Roach, Sep 14, 2007, in forum: ASP .Net Web Services
    Replies:
    0
    Views:
    108
    Danielle Roach
    Sep 14, 2007
  4. Replies:
    0
    Views:
    499
  5. Mark
    Replies:
    0
    Views:
    110
Loading...

Share This Page