Recommend this page to a friend! |
PHP OAuth Library | > | PHP OAuth Library package blog | > | How Can the PHP OAuth... | > | All threads | > | google webmaster tools class problem | > | (Un) Subscribe thread alerts |
|
![]() I am getting 403 error when trying to use this class. I got an emai from google where they toldme that access was denied and that if I want to use this app/software to login I have to enable "less secure apps".
I enabled them, but I go on getting 403 error...why? Is there any start-up opration/configuration to do? I have just copied all required classes in the folder together with the example cript top_pages_example.php
![]() I am not sure what code you are using.
The other Webmaster Tools package is not using OAuth yet. What code are you using to call Webmaster Tools API?
![]() <?php
/* * access_top_pages.php * * @(#) $Id: access_top_pages.php,v 1.3 2013/07/16 12:36:48 mlemos Exp $ * */ require('wmt/http.php'); require('wmt/oauth_client.php'); require('wmt/xml_parser.php'); require('wmt/web_master_tools.php'); require('wmt/forms.php'); require('wmt/form_layout_vertical.php'); require('wmt/top_pages.php'); $top_pages = new top_pages_class; if(($success = $top_pages->Initialize())) $success = $top_pages->Finalize($top_pages->Process()); if($top_pages->exit) exit; if($success) $top_pages->Output(); else { ?> <h1>Top pages error</h1> <pre>Error: <?php echo HtmlSpecialChars($top_pages->error); ?></pre> <?php } ?>
![]() The inclusion of the OAuth class there is not needed because the class does not use OAuth for now.
Google released Webmaster Tools API 2 with OAuth support but since the necessary API calls are not yet documented, this class still uses the old version 1 API which does not rely on OAuth. Those errors you are getting must be something like you are trying to login with a user without permissions. Try setting the debug variable to true and check your PHP error logs files to see what messages appear there for more hints about your problem.
![]() I'm getting 403 error
[Mon Dec 01 20:59:01 2014] [warn] [client XXX.XXX.XXX.XXX] mod_fcgid: stderr: Connecting to www.google.com, referer: https://mysubdomain.mydomain.com/wmt/access_top_pages.php [Mon Dec 01 20:59:01 2014] [warn] [client XXX.XXX.XXX.XXX] mod_fcgid: stderr: Resolving HTTP server domain "www.google.com"..., referer: https://mysubdomain.mydomain.com/wmt/access_top_pages.php [Mon Dec 01 20:59:01 2014] [warn] [client XXX.XXX.XXX.XXX] mod_fcgid: stderr: Connecting to HTTP server IP 173.194.113.52 port 443..., referer: https://mysubdomain.mydomain.com/wmt/access_top_pages.php [Mon Dec 01 20:59:01 2014] [warn] [client XXX.XXX.XXX.XXX] mod_fcgid: stderr: Connected to www.google.com, referer: https://mysubdomain.mydomain.com/wmt/access_top_pages.php [Mon Dec 01 20:59:01 2014] [warn] [client XXX.XXX.XXX.XXX] mod_fcgid: stderr: C POST /accounts/ClientLogin HTTP/1.1, referer: https://mysubdomain.mydomain.com/wmt/access_top_pages.php [Mon Dec 01 20:59:01 2014] [warn] [client XXX.XXX.XXX.XXX] mod_fcgid: stderr: C Host: www.google.com, referer: https://mysubdomain.mydomain.com/wmt/access_top_pages.php [Mon Dec 01 20:59:01 2014] [warn] [client XXX.XXX.XXX.XXX] mod_fcgid: stderr: C User-Agent: httpclient (http://www.phpclasses.org/httpclient $Revision: 1.92 $), referer: https://mysubdomain.mydomain.com/wmt/access_top_pages.php [Mon Dec 01 20:59:01 2014] [warn] [client XXX.XXX.XXX.XXX] mod_fcgid: stderr: C Connection: Keep-Alive, referer: https://mysubdomain.mydomain.com/wmt/access_top_pages.php [Mon Dec 01 20:59:01 2014] [warn] [client XXX.XXX.XXX.XXX] mod_fcgid: stderr: C Content-Type: application/x-www-form-urlencoded, referer: https://mysubdomain.mydomain.com/wmt/access_top_pages.php [Mon Dec 01 20:59:01 2014] [warn] [client XXX.XXX.XXX.XXX] mod_fcgid: stderr: C Content-Length: 136, referer: https://mysubdomain.mydomain.com/wmt/access_top_pages.php [Mon Dec 01 20:59:01 2014] [warn] [client XXX.XXX.XXX.XXX] mod_fcgid: stderr: C , referer: https://mysubdomain.mydomain.com/wmt/access_top_pages.php [Mon Dec 01 20:59:01 2014] [warn] [client XXX.XXX.XXX.XXX] mod_fcgid: stderr: C accountType=HOSTED_OR_GOOGLE&Email=robert72%40dublin.com&Passwd=XXX&service=sitemaps&source=Manuel+Lemos-Webmaster+Tools+Client-1.0, referer: https://mysubdomain.mydomain.com/wmt/access_top_pages.php [Mon Dec 01 20:59:01 2014] [warn] [client XXX.XXX.XXX.XXX] mod_fcgid: stderr: S HTTP/1.1 403 Forbidden, referer: https://mysubdomain.mydomain.com/wmt/access_top_pages.php [Mon Dec 01 20:59:01 2014] [warn] [client XXX.XXX.XXX.XXX] mod_fcgid: stderr: S Content-Type: text/plain, referer: https://mysubdomain.mydomain.com/wmt/access_top_pages.php [Mon Dec 01 20:59:01 2014] [warn] [client XXX.XXX.XXX.XXX] mod_fcgid: stderr: S X-Frame-Options: DENY, referer: https://mysubdomain.mydomain.com/wmt/access_top_pages.php [Mon Dec 01 20:59:01 2014] [warn] [client XXX.XXX.XXX.XXX] mod_fcgid: stderr: S Cache-control: no-cache, no-store, referer: https://mysubdomain.mydomain.com/wmt/access_top_pages.php [Mon Dec 01 20:59:01 2014] [warn] [client XXX.XXX.XXX.XXX] mod_fcgid: stderr: S Pragma: no-cache, referer: https://mysubdomain.mydomain.com/wmt/access_top_pages.php [Mon Dec 01 20:59:01 2014] [warn] [client XXX.XXX.XXX.XXX] mod_fcgid: stderr: S Expires: Mon, 01-Jan-1990 00:00:00 GMT, referer: https://mysubdomain.mydomain.com/wmt/access_top_pages.php [Mon Dec 01 20:59:01 2014] [warn] [client XXX.XXX.XXX.XXX] mod_fcgid: stderr: S Date: Mon, 01 Dec 2014 19:59:01 GMT, referer: https://mysubdomain.mydomain.com/wmt/access_top_pages.php [Mon Dec 01 20:59:01 2014] [warn] [client XXX.XXX.XXX.XXX] mod_fcgid: stderr: S X-Content-Type-Options: nosniff, referer: https://mysubdomain.mydomain.com/wmt/access_top_pages.php [Mon Dec 01 20:59:01 2014] [warn] [client XXX.XXX.XXX.XXX] mod_fcgid: stderr: S X-XSS-Protection: 1; mode=block, referer: https://mysubdomain.mydomain.com/wmt/access_top_pages.php [Mon Dec 01 20:59:01 2014] [warn] [client XXX.XXX.XXX.XXX] mod_fcgid: stderr: S Content-Length: 341, referer: https://mysubdomain.mydomain.com/wmt/access_top_pages.php [Mon Dec 01 20:59:01 2014] [warn] [client XXX.XXX.XXX.XXX] mod_fcgid: stderr: S Server: GSE, referer: https://mysubdomain.mydomain.com/wmt/access_top_pages.php [Mon Dec 01 20:59:01 2014] [warn] [client XXX.XXX.XXX.XXX] mod_fcgid: stderr: S Alternate-Protocol: 443:quic,p=0.02, referer: https://mysubdomain.mydomain.com/wmt/access_top_pages.php [Mon Dec 01 20:59:01 2014] [warn] [client XXX.XXX.XXX.XXX] mod_fcgid: stderr: S , referer: https://mysubdomain.mydomain.com/wmt/access_top_pages.php [Mon Dec 01 20:59:01 2014] [warn] [client XXX.XXX.XXX.XXX] mod_fcgid: stderr: Disconnected from www.google.com, referer: https://mysubdomain.mydomain.com/wmt/access_top_pages.php
![]() Everytime I try to access I get an email from google "somebody has tried to access your account" and in the account activities I find this:
Someone has your password. Google prevented the sign-in. Learn more Unknown device Time: Just now Location: Netherlands IP address: IP OF THE SERVER ©2014 Google - Terms of Use Approximate location (may include nearby towns) Do you recognize this activity? If not, someone else might have your password.
![]() solved:
I had to open this page: accounts.google.com/DisplayUnlockCa ...after that, I had 10 mnutes to login, and this time login was allowed
![]() Good, I remember I had that problem too.
Anyway, future versions will use OAuth 2 and so do not have that problem. We just need to wait for Google to add those features to Webmaster Tools API V2. |
info at phpclasses dot org
.