title: I am trying to connect to gtalk using xmpppy. How do I authenticate? Simple code I found in many places isn't working
body: <p>The code I used:</p>
  
  <pre><code>import xmppy
  jid = xmpp.JID('user@gmail.com')
  cl = xmpp.Client(jid.getDomain())
  cl.connect(server=('talk.google.com',5222))
  cl.auth('user@gmail.com', 'password','something')
  </code></pre>
  
  <p>It seems to be working till the connect, I get 'tls' as a return from connect.
  After that, the <code>cl.auth</code> fails.
  I have tried using the user name with and without the @gmail.com . I have tried with a different user, so my password is not wrong.
  I have tried using 5223 instead of 5222, in which case i get 'ssl' as a return.</p>
  
  <p>Here is the debug output I get:</p>
  
  <pre><code>DEBUG: socket       got   &lt;stream:stream from="gmail.com" id="960A4092BC8F9722" version="1.0" xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client"&gt;
    &lt;stream:features&gt;
    &lt;mechanisms xmlns="urn:ietf:params:xml:ns:xmpp-sasl"&gt;
    &lt;mechanism&gt;PLAIN&lt;/mechanism&gt;
    &lt;mechanism&gt;X-GOOGLE-TOKEN&lt;/mechanism&gt;
    &lt;mechanism&gt;X-OAUTH2&lt;/mechanism&gt;
    &lt;/mechanisms&gt;
    &lt;/stream:features&gt;
  DEBUG: dispatcher   warn  Unknown stanza: features
  DEBUG: dispatcher   ok    Dispatching unknown stanza with type-&gt; props-&gt;[u'urn:ietf:params:xml:ns:xmpp-sasl'] id-&gt;None
  DEBUG: sasl         start Plugging &lt;xmpp.auth.SASL instance at 0x2f22998&gt; into &lt;xmpp.client.Client instance at 0x2f19bd8&gt;
  DEBUG: dispatcher   info  Registering handler &lt;bound method SASL.SASLHandler of &lt;xmpp.auth.SASL instance at 0x2f22998&gt;&gt; for "challenge" type-&gt; ns-&gt;(urn:ietf:params:xml:ns:xmpp-sasl)
  DEBUG: dispatcher   warn  Registering namespace "urn:ietf:params:xml:ns:xmpp-sasl"
  DEBUG: dispatcher   info  Registering protocol "unknown" as &lt;class 'xmpp.protocol.Protocol'&gt;(urn:ietf:params:xml:ns:xmpp-sasl)
  DEBUG: dispatcher   info  Registering protocol "default" as &lt;class 'xmpp.protocol.Protocol'&gt;(urn:ietf:params:xml:ns:xmpp-sasl)
  DEBUG: dispatcher   warn  Registering protocol "challenge" as &lt;class 'xmpp.protocol.Protocol'&gt;(urn:ietf:params:xml:ns:xmpp-sasl)
  DEBUG: dispatcher   info  Registering handler &lt;bound method SASL.SASLHandler of &lt;xmpp.auth.SASL instance at 0x2f22998&gt;&gt; for "failure" type-&gt; ns-&gt;(urn:ietf:params:xml:ns:xmpp-sasl)
  DEBUG: dispatcher   warn  Registering protocol "failure" as &lt;class 'xmpp.protocol.Protocol'&gt;(urn:ietf:params:xml:ns:xmpp-sasl)
  DEBUG: dispatcher   info  Registering handler &lt;bound method SASL.SASLHandler of &lt;xmpp.auth.SASL instance at 0x2f22998&gt;&gt; for "success" type-&gt; ns-&gt;(urn:ietf:params:xml:ns:xmpp-sasl)
  DEBUG: dispatcher   warn  Registering protocol "success" as &lt;class 'xmpp.protocol.Protocol'&gt;(urn:ietf:params:xml:ns:xmpp-sasl)
  DEBUG: socket       sent  &lt;auth xmlns="urn:ietf:params:xml:ns:xmpp-sasl" mechanism="PLAIN"&gt;Y3MxMGIwNTlAZ21haWwuY29tQGdtYWlsLmNvbQBjczEwYjA1OUBnbWFpbC5jb20AcHZ6bXZoN3FjYzE=&lt;/auth&gt;
  DEBUG: socket       error Socket error while receiving data
  Traceback (most recent call last):
    File "/usr/local/lib/python2.7/dist-packages/xmpppy-0.5.0rc1-py2.7.egg/xmpp/transports.py", line 153, in receive
      try: received = self._recv(BUFLEN)
  SSLError: [Errno 8] _ssl.c:1359: EOF occurred in violation of protocol
  DEBUG: client       stop  Disconnect detected
  DEBUG: socket       error Socket operation failed
  DEBUG: sasl         stop  Plugging &lt;xmpp.auth.SASL instance at 0x2f22998&gt; out of &lt;xmpp.client.Client instance at 0x2f19bd8&gt;.
  </code></pre>