shuhaib864 / xmpphp

Automatically exported from code.google.com/p/xmpphp
0 stars 0 forks source link

Auth fails when connecting to google #54

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1.

<?php

// activate full error reporting
error_reporting(E_ALL & E_STRICT);

include 'XMPPHP/XMPP.php';
require_once 'XMPPHP/Log.php';
//include 'XMPPHP/XMPP_Old.php';

#Use XMPPHP_Log::LEVEL_VERBOSE to get more logging for error reports
#If this doesn't work, are you running 64-bit PHP with < 5.2.6?
echo "a";
$conn = new XMPPHP_XMPP('talk.google.com', 5222, '173turnips', 'password',
'xmpphp', 'gmail.com', $printlog=true , $loglevel=XMPPHP_Log::LEVEL_VERBOSE);
try {
//     $conn->useEncryption(false);
    $conn->connect();
    $conn->processUntil('session_start');
    $conn->presence();
    $conn->message('172turnips@gmail.com', 'This is a test message!');
    $conn->disconnect();
} catch(XMPPHP_Exception $e) {
    die($e->getMessage());

}

Produces:

live:~/xmpp/xmpphp# php sendmessage_example.php
a1242988791 [INFO]: Connecting to tcp://talk.google.com:5222
1242988791 [VERBOSE]: Socket is ready; send it.
1242988791 [VERBOSE]: SENT: <stream:stream to="gmail.com"
xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client"
version="1.0">
1242988791 [VERBOSE]: Successfully sent 114 bytes.
1242988791 [VERBOSE]: RECV: <stream:stream from="gmail.com"
id="8E2A6A83DD41C9B0" version="1.0"
xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client">
1242988791 [VERBOSE]: RECV: <stream:features><starttls
xmlns="urn:ietf:params:xml:ns:xmpp-tls"><required/></starttls><mechanisms
xmlns="urn:ietf:params:xml:ns:xmpp-sasl"><mechanism>X-GOOGLE-TOKEN</mechanism></
mechanisms></stream:features>
1242988791 [DEBUG]: Calling features_handler
1242988791 [VERBOSE]: Socket is ready; send it.
1242988791 [VERBOSE]: SENT: <starttls
xmlns='urn:ietf:params:xml:ns:xmpp-tls'><required /></starttls>
1242988791 [VERBOSE]: Successfully sent 73 bytes.
1242988791 [VERBOSE]: RECV: <proceed xmlns="urn:ietf:params:xml:ns:xmpp-tls"/>
1242988791 [DEBUG]: Calling tls_proceed_handler
1242988791 [INFO]: Starting TLS encryption
1242988791 [VERBOSE]: Socket is ready; send it.
1242988791 [VERBOSE]: SENT: <stream:stream to="gmail.com"
xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client"
version="1.0">
1242988791 [VERBOSE]: Successfully sent 114 bytes.
1242988792 [VERBOSE]: RECV: <stream:stream from="gmail.com"
id="8902C7059B808D24" version="1.0"
xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client">
1242988792 [VERBOSE]: RECV: <stream:features><mechanisms
xmlns="urn:ietf:params:xml:ns:xmpp-sasl"><mechanism>PLAIN</mechanism><mechanism>
X-GOOGLE-TOKEN</mechanism></mechanisms></stream:features>
1242988792 [DEBUG]: Calling features_handler
1242988792 [INFO]: Attempting Auth...
1242988792 [VERBOSE]: Socket is ready; send it.
1242988792 [VERBOSE]: SENT: <auth xmlns='urn:ietf:params:xml:ns:xmpp-sasl'
mechanism='PLAIN'>ADE3M3R1cm5pcHMAZXZlbnN0YXI=</auth>
1242988792 [VERBOSE]: Successfully sent 100 bytes.
1242988792 [VERBOSE]: RECV: <failure
xmlns="urn:ietf:params:xml:ns:xmpp-sasl"><not-authorized/></failure>
1242988792 [DEBUG]: Calling sasl_failure_handler
1242988792 [ERROR]: Auth failed!
1242988792 [VERBOSE]: Disconnecting...
1242988792 [VERBOSE]: Socket is ready; send it.
1242988792 [VERBOSE]: SENT: </stream:stream>
1242988792 [VERBOSE]: Successfully sent 16 bytes.
1242988792 [VERBOSE]: RECV: </stream:stream>

I have replaced the correct password above with a dummy, as this message is
public. I am happy to email you the correct password. My email: "c.hale at
mercia.net".

I realise the te above would normally suggest that the login/password was
incorrect, but I can reliably login using pidgin or the gmail web interface
to google chat using the same credientials.

What version of the product are you using? On what operating system?

php 5.2.6 on Linux debian 2.6.8-2-386

Any help would be much appreciated, and thanks for making the project
available.

Chris.

Original issue reported on code.google.com by 173turn...@googlemail.com on 22 May 2009 at 11:03

GoogleCodeExporter commented 8 years ago
Oh yeah im using the code from SVN.

Original comment by 173turn...@googlemail.com on 22 May 2009 at 11:05

GoogleCodeExporter commented 8 years ago
I had the same issue, just add curl extension (php5-curl) and able encriptation.

Original comment by rodrigoe...@gmail.com on 22 Sep 2009 at 7:05

GoogleCodeExporter commented 8 years ago
same problem for me

Original comment by vodemo1....@gmail.com on 4 Mar 2010 at 8:07

GoogleCodeExporter commented 8 years ago
so did i

Original comment by i...@live.com on 25 Feb 2011 at 9:34

GoogleCodeExporter commented 8 years ago
I have exactly the same problem, is there any solution?

Original comment by i...@novatrend.ch on 3 Mar 2011 at 10:39

GoogleCodeExporter commented 8 years ago
just tried to use xmpphp to connect to gtalk (with google apps account) and 
encountered the same problem. any solution?

Paket: libapache2-mod-php5
Zustand: Installiert
Automatisch installiert: nein
Version: 5.3.3-7+squeeze8

Linux toliman 2.6.32.27_INGATE_v #5 SMP Mon Feb 14 04:25:37 CET 2011 x86_64 
GNU/Linux

Original comment by mich...@mimeit.de on 9 Mar 2012 at 5:54

GoogleCodeExporter commented 8 years ago
The default implementation of XMPPHP_XMPP uses PLAIN as mechanism (see xmpp.php 
inside the features_handler method).
Your XMPP server may not support the PLAIN mechanism: e.g. if been using 
prosody that only knows SCRAM-SHA-1 and DIGEST-MD5. You get the supported 
mechanism before attempting to authenticate, in your case: 
<mechanism>X-GOOGLE-TOKEN</mechanism></mechanisms></stream:features>

If you want to use another mechanism (or have to use another mechanism) you 
need to modify the XMPP.php file.
For the DIGEST-MD5 you can find a patch file at 
http://code.google.com/p/xmpphp/issues/detail?id=67&q=md5

Original comment by dragos.a...@gmail.com on 24 Aug 2012 at 10:56