cuongpd / gapi-google-analytics-php-interface

Automatically exported from code.google.com/p/gapi-google-analytics-php-interface
0 stars 0 forks source link

Login Fail. #9

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1.
2.
3.

What is the expected output? What do you see instead?
google-analytics report, error message.

What version of the product are you using? On what operating system?
1.3, webserver is running: Apache ver.  2.2.10 (Unix)

Please provide any additional information below.
Hi, experiencing problems with this API, copied the files onto my 
webserver into a new folder, and tried the 'example.account.php' without 
success, edited the file to:
-----------
<?php

require 'gapi.class.php';

$ga = new gapi('xxemailxx','xxpassxx');

$ga->requestReportData(145141242,array('browser','browserVersion'),array
('pageviews','visits'));

foreach($ga->getResults() as $result)
{
  echo '<strong>'.$result.'</strong><br />';
  echo 'Pageviews: ' . $result->getPageviews() . ' ';
  echo 'Visits: ' . $result->getVisits() . '<br />';
}

echo '<p>Total pageviews: ' . $ga->getPageviews() . ' total visits: ' . 
$ga->getVisits() . '</p>';
?>

------------

Error returned is:
-----
Fatal error: Uncaught exception 'Exception' with message 'GAPI: Failed to 
authenticate user... thrown in /home/a8643201/public_html/ga_pi/
gapi.class.php on line 418
----

Please assist, am i doing something wrong!?

Original issue reported on code.google.com by onyxgo...@gmail.com on 22 Jul 2009 at 8:29

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
You must have curl for php

Original comment by george.anchev on 13 Aug 2009 at 9:26

GoogleCodeExporter commented 9 years ago
CURL support    enabled
CURL Information    libcurl/7.15.5 OpenSSL/0.9.8b zlib/1.2.3 libidn/0.6.5

[Fri Aug 14 12:58:34 2009] [error] [client 68.25.18.145] PHP Fatal error:  
Uncaught
exception 'Exception' with message 'GAPI: Failed to authenticate user. Error:
"CaptchaToken=fhYMpFlVrioQoUd49UaeGHqfaeQmh_cds3dopP9JnvdVnQBClW1vMfTZrW8tghFYEF
Guzmc0L8OcW6bQxYqkFCjqWMtv2tzA1cImWX9EX8U:DYKfL87l3K7ZiZ4hulbpiA\nCaptchaUrl=Cap
tcha?ctoken=fhYMpFlVrioQoUd49UaeGHqfaeQmh_cds3dopP9JnvdVnQBClW1vMfTZrW8tghFYEFGu
zmc0L8OcW6bQxYqkFCjqWMtv2tzA1cImWX9EX8U%3ADYKfL87l3K7ZiZ4hulbpiA\nError=CaptchaR
equired\nUrl=https://www.google.com/accounts/ErrorMsg?Email=patrick.mdwestserve%
40gmail.com&service=analytics&id=cr&timeStmp=1250269069&secTok=f21ed374169f21bf6
45b50f35976b1d7\n"'
in /serverRoot/gapi.class.php:418\nStack trace:\n#0
/serverRoot/mod_g_a_api/gapi.class.php(62): gapi->authenticateUser('xxuserxx',
'xxpasswordxx')\n#1 /serverRoot/mod_g_a_api/example.account.php(7):
gapi->__construct('patrick.mdwests...', 'zerohour')\n#2 {main}\n  thrown in
/thirdParty/joomla/modules/mod_g_a_api/gapi.class.php on line 418

Original comment by patrick....@gmail.com on 14 Aug 2009 at 5:00

GoogleCodeExporter commented 9 years ago
scratch that google is letting it through now... strange

Original comment by patrick....@gmail.com on 14 Aug 2009 at 6:05

GoogleCodeExporter commented 9 years ago
I was getting this same issue. I fixed it by going to 
https://www.google.com/a/example.com/UnlockCaptcha to 
unlock the specific account (where example.com should obviously be changed).

Original comment by aidanfin...@gmail.com on 16 Sep 2009 at 8:43

GoogleCodeExporter commented 9 years ago
I am getting the same issue my curl is on in php.ini

Original comment by asull...@gmail.com on 20 Oct 2009 at 9:45

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Aside from curl, you also need protocol https enabled in libcurl.

In phpinfo() under Curl check the variable SSL. Must be "yes". If not, you need 
to 
enable SSL in curl. In WHM go to EasyApache and check curlssl.

Original comment by oshuamor...@gmail.com on 17 Feb 2010 at 6:53

GoogleCodeExporter commented 9 years ago
I'm getting this...

Uncaught exception 'Exception' with message 'GAPI: Failed to authenticate user. 
Error: 
"CaptchaToken=5a0HEi5ePyhBN80e_HCW2nI08r8hapTZX56vZTUq6bTSr7x8uV5xX-nKAMMWEFNpiu
C0JyHQOMTE8EfPGlZk5aue03MphpTNQZ7JGJr_W0c:VQ2w3JC_UKtfeBjtjSi3dg\nCaptchaUrl=Cap
tcha?ctoken=5a0HEi5ePyhBN80e_HCW2nI08r8hapTZX56vZTUq6bTSr7x8uV5xX-nKAMMWEFNpiuC0
JyHQOMTE8EfPGlZk5aue03MphpTNQZ7JGJr_W0c%3AVQ2w3JC_UKtfeBjtjSi3dg\nError=CaptchaR
equired\nUrl=https://www.google.com/accounts/ErrorMsg?Email=MY-EMAIL-ADDRESS-GOE
S-HERE@DOMAIN.COM&service=analytics&id=cr&timeStmp=1276066723&secTok=cab6a8120cc
148941c33efc655c02a70

I think the API should be able to figure out if it uses fopen/curl, but no 
matter what I set the value (it's normally set as "auto") the error is same. To 
me it seems that Google has captcha in the URL, which is of course impossible 
to fill in automatically.

Original comment by tomi.kul...@gmail.com on 9 Jun 2010 at 7:10

GoogleCodeExporter commented 9 years ago
curl and openssl 

Original comment by zys...@gmail.com on 30 Jun 2010 at 4:50

GoogleCodeExporter commented 9 years ago
My hosting provider doesn't have curl support enabled. I have the same problem. 
How can I make things work with fopen?

Original comment by kalba...@gmail.com on 12 Jul 2010 at 12:45

GoogleCodeExporter commented 9 years ago
Anybody please help me about this Google Analytic code Error Showing : "Failed 
to authenticate, please check your email and password."...

  pls help...Thanks in Adv...Nijananda (rtrath@gmail.com)

Original comment by autodeal...@gmail.com on 28 Jul 2010 at 7:02

GoogleCodeExporter commented 9 years ago
Had a similar problem with a password with leading @ carachter. I've solved 
changing the password. I think the problem is curl related, but not sure...

Original comment by gian...@gmail.com on 17 Aug 2010 at 4:55

GoogleCodeExporter commented 9 years ago
I have the same problem, my cURL support is enabled, ssl is yes. I use xamp 
1.7.3

Original comment by thd.viet...@gmail.com on 17 Sep 2010 at 2:59

GoogleCodeExporter commented 9 years ago
I have the same problem.
From my side it seems to appear when I made lots of call to gapi (around 200 in 
10 minutes).
I got a similar problem when I curled Google Analytics directly (I mean using 
the old method).

Original comment by jeremy.b...@gmail.com on 8 Jan 2011 at 10:39

GoogleCodeExporter commented 9 years ago
the same too ,what?

Original comment by gxh...@gmail.com on 17 Mar 2011 at 11:36

GoogleCodeExporter commented 9 years ago
I have the same problem
- my password doesn't contain any special character, only letters...
- i have curl and opensll (Bluehost servers, if it helps)

curl
cURL support    enabled
cURL Information    libcurl/7.20.0 OpenSSL/0.9.8b zlib/1.2.3 libidn/0.6.5

openssl
OpenSSL support enabled
OpenSSL Version 0.9.8l

Original comment by pedrogom...@gmail.com on 9 May 2011 at 6:57

GoogleCodeExporter commented 9 years ago
I could fix the problem changing the password as well. It had a @ as first char

Original comment by pedrogom...@gmail.com on 28 Jul 2011 at 6:11

GoogleCodeExporter commented 9 years ago
O google recentemente realizou migrações em suas contas, aqui tive o mesmo 
problema, o que tem que ser feito e alterar a senha da sua conta de acesso ao 
analitycs depois disso a api volta a funcionar normalmente.

Original comment by cont...@agenciaja.com on 23 Aug 2011 at 2:54

GoogleCodeExporter commented 9 years ago
CURL times out if you are behind a proxy.

I have modified the gapi class to work with proxies. I would love to commit it 
to the  this API. I do not know how though.

Original comment by chaitany...@gmail.com on 15 Dec 2011 at 5:45

GoogleCodeExporter commented 9 years ago
you must create an application password for gapi at your google account. And 
use it. will fix your problem!

Original comment by tnr...@gmail.com on 15 Jan 2012 at 12:18

GoogleCodeExporter commented 9 years ago
You need to create application specific password in order to access it 

  https://accounts.google.com/b/0/IssuedAuthSubTokens#accesscodes 

Create a new password by typing Analytics in the input box and use that 
password , it will work..

Original comment by virk.off...@gmail.com on 28 Jan 2012 at 11:21

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Creating an application specific password and using it wouldn't work, I am 
getting the same error which is 

GAPI: Failed to authenticate user. Error: 
"CaptchaToken=bNHJ6hJum5fxgyzTtP6iBDoVQnz4DbFAfFaCwG3jzYX4PBMXnbik99aKdus8piqdVR
pSNBjZkpWe3MX6eOUGpkYZ2B5z8hTEh6zBDa_TZXM:iBTGoTI-i15BxYvjBstxdQ 
CaptchaUrl=Captcha?ctoken=bNHJ6hJum5fxgyzTtP6iBDoVQnz4DbFAfFaCwG3jzYX4PBMXnbik99
aKdus8piqdVRpSNBjZkpWe3MX6eOUGpkYZ2B5z8hTEh6zBDa_TZXM%3AiBTGoTI-i15BxYvjBstxdQ 
Error=CaptchaRequired 
Url=https://www.google.com/accounts/ErrorMsg?Email=xx%40gmail.com&service=analyt
ics&id=cr&timeStmp=1328562504&secTok=.AG5fkS-Rr9mhWimKXEHnoyDG-ZTzLdY2xA%3D%3D "

Original comment by hiteshku...@gmail.com on 6 Feb 2012 at 9:13

GoogleCodeExporter commented 9 years ago
http://groups.google.com/group/google-analytics-data-export-api/browse_thread/th
read/3fb2379685c60d51

This worked for me .. 

Original comment by hiteshku...@gmail.com on 6 Feb 2012 at 10:58

GoogleCodeExporter commented 9 years ago
"You need to create application specific password in order to access it"

Worked for me thanks a lot !

Original comment by milherou...@gmail.com on 9 Mar 2012 at 10:33

GoogleCodeExporter commented 9 years ago
I am having a similar problem, only I am unable to authenticate with no 
response.
PHP Fatal error:  Uncaught exception 'Exception' with message 'GAPI: Failed to 
authenticate user. Error: ""' in gapi.class.php:418

I am running this via PHP CLI and no matter whether I use curl or fopen both 
produce the same problem.  I have even tried using the CURLOPT_PROXY option 
since I am behind a proxy, still same issue.

What do I need to do to get this to work?

Original comment by g1ngerni...@hotmail.com on 18 May 2012 at 9:29

GoogleCodeExporter commented 9 years ago
I figured out what the problem was, I need to use CURLOPT_PROXYUSERPWD to 
authenticate a user.  However now that I have done this, PHP CLI crashes!  What 
is going on, I am using version 5.4.3.

Original comment by g1ngerni...@hotmail.com on 18 May 2012 at 1:23

GoogleCodeExporter commented 9 years ago
Change Password fixed error

Original comment by verifyad...@gmail.com on 8 Aug 2012 at 3:26

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Hi, you should call this method only once:

$ga = new gapi('email-gmail', 'pass-gmail');

it works for me
thanks

Original comment by f3rn4nd...@gmail.com on 2 Sep 2012 at 4:45

GoogleCodeExporter commented 9 years ago
nothing works! Suggestion?

Original comment by wallb...@gmail.com on 31 Oct 2013 at 2:49

GoogleCodeExporter commented 9 years ago
Tentou dar permissão na sua conta google ?

Original comment by estudiow...@gmail.com on 2 Apr 2014 at 1:27

GoogleCodeExporter commented 9 years ago
This even work anymore?

https://accounts.google.com/b/0/IssuedAuthSubTokens#accesscodes 
Show nothing related to what was discussed and redirects somewhere else.
All I see is "Account Permission" and no where to 'enter a password'

No idea they are even talking about here.
http://groups.google.com/group/google-analytics-data-export-api/browse_thread/th
read/3fb2379685c60d51

I also get no errors, nothing at all. Just a blank page as well as Denied 
Logins.

Original comment by A...@websites4you.com on 15 Oct 2014 at 9:09

GoogleCodeExporter commented 9 years ago
Working!, the "@" issue in the password fixed it for me, just changed it to a 
more simple solution.

Remember to crate the API for analytics:
https://code.google.com/apis/console/

And unlock account:
https://accounts.google.com/displayunlockcaptcha  

Thanks =)

Original comment by andres.l...@gmail.com on 25 Nov 2014 at 8:17

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Hi andres,
is it a problem @ in password ?
and please tell me where i can get password specification for GAPI.
Because i got the following error (Failed to authenticate) -

Got this error-

Fatal error: Uncaught exception 'Exception' with message 'GAPI: Failed to 
authenticate user. Error: ""' in /var/tools/gapi.class.php:418 Stack trace: #0 
/var/www/RPT-145/tools/gapi.class.php(62): 
gapi->authenticateUser('abc@gmail...', '@abc123@123@') #1 
/var/transaction_report.php(37): gapi->__construct('abc@gmail...', 
'@abc123@123@') #2 {main} thrown in /var/tools/gapi.class.php on line 418

Please help me to solve this
thanks in advance :)

Original comment by kapilver...@gmail.com on 28 Nov 2014 at 12:08