Hi,
I have installed drupal 7.15.15and the below modules:

Google Analytics Reports
Google Analytics API
Google Analytics
all the required modules for the above modules were installed.
The issue is that after I submit "Start setup and Authorize account" in the Google Analytics Report page I receive the ""Invalid Token"" message.
https://accounts.google.com/OAuthAuthorizeToken?oauth_token=&hd=

I have attached screen shots. please help in this, what need to be done to avoid this error

Thanks,
kumar

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

grendzy’s picture

"php_network_getaddresses: getaddrinfo failed: No such host is known" indicates a problem with your network. Drupal tried to contact https://www.google.com/accounts/OAuthGetRequestToken, and couldn't find the IP address.

Some possible causes: you weren't connected to the internet at that time, DNS was misconfigured, or a firewall was blocking access.

Ganesh_Drupal’s picture

Hi,
I am facing the same issue. I don't think I have any issue with my internet access though. Not sure how to cross check about Firewall blockage. Also, I am not sure what do you mean by "DNS Misconfiguration". Please advise.
-Ganesh

Ganesh_Drupal’s picture

My host file has entry: 127.0.0.1 ecs.localhost
And to run the Drupal locally I need to diable the proxy for ecs.localhost

Not sure if this is a cause? But i can not run Drupal locally without disabling the proxy for ecs.localhost

grendzy’s picture

Status: Active » Fixed

It's not clear from your post what kind of proxy you're describing. However, if your network requires using a forward proxy for outgoing HTTP, then Drupal 7.16 (soon to be released) will help you.

#7881: Add support to drupal_http_request() for proxy servers (http not https)

kumarE’s picture

Status: Fixed » Active
FileSize
95.76 KB
95.76 KB

hi,

I tried with using drupal-7.x-dev.tar.gz and modiifed the default.settings.php and settings.php file for proxy forwarding, but getting same message with invalid token and unable to connect to the google accont . PFA, details on request and response

What could be the reason, is there any other configuration missing?

Thanks,
kumar

grendzy’s picture

FileSize
62.95 KB

Can you try this test please:

  • enable the devel module
  • Visit /devel/php
  • submit the following code:
    dpm(drupal_http_request('https://www.google.com/accounts/OAuthGetRequestToken'));

This is only a connectivity test, the URL in that snippet is missing some important parameters so a successful test would be a "parameter absent" response. I haven't used Drupal's new proxy feature yet so I can't advise you there.

kumarE’s picture

FileSize
55.79 KB

please see the attached, the result after /devel/php

kumarE’s picture

FileSize
13.41 KB

Is this patch works for https too?, initilize and doing setup on google report module redirect to https page.
PFA, is this log message helps

Thanks,
kumar

kumarE’s picture

Is this patch works for https too?, initilize and doing setup on google report module redirect to https page.
PFA, is this log message helps

Thanks,
kumar

grendzy’s picture

Status: Active » Fixed

From the attachment in comment #5, it appears your proxy uses NTLM authentication. Drupal 7.16's proxy feature only supports basic authentication.

Your best solution is probably to convince your network administrator to allow the web server direct access to the internet, without a proxy, or to support basic authentication.

Since I don't have experience with NTLM proxies, I won't be able to advise you any further. I also think it's best to close this issue, since NTLM proxy issues aren't specific to the analytics module. If you need additional help, http://drupal.org/support and http://drupal.stackexchange.com/ are good resources.

kumarE’s picture

Status: Fixed » Active
FileSize
47.11 KB

http://drupal.stackexchange.com/questions/46207/proxy-issue-for-ga-repor...

I cheked with network team, and checked with proxy which using basic authentication method
I applied patchs to support proxy for the drupal module( we are using basic authetication method). but , please see the details what i am getting when i try to connect the google account

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

GET https://www.google.com/accounts/OAuthGetRequestToken?max-results=1000&oa... HTTP/1.0 User-Agent: Drupal (+http://drupal.org/) Host: www.google.com

HTTP/1.1 400 Bad Request Cache-Control: no-cache Pragma: no-cache Content-Type: text/html; charset=utf-8 Proxy-Connection: close Connection: close

Content-Length: 691
Could you please let me know what could the issue which causing issue in connecting google account through reporting module

Thanks,
KumarE

kumarE’s picture

FileSize
53.09 KB

PFA, attaching new screen shot, see is this helps to sort out issue

Thanks,
kumarE

unixengineer’s picture

The drupal_http_request does not handle corporate proxies well. Here is the custom function that I wrote to fix this exact issue:

function curl_http_request($url, $headers, $method, $data)
{
       $result = new stdClass();
       $ch = curl_init();
       curl_setopt ($ch, CURLOPT_URL,$url);
       curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
       curl_setopt ($ch, CURLOPT_TIMEOUT, 60);
       curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, 1);
       curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
       curl_setopt ($ch, CURLOPT_COOKIEJAR, $gacookie);
       curl_setopt ($ch, CURLOPT_COOKIEFILE, $gacookie);
       curl_setopt ($ch, CURLOPT_POSTFIELDS, $data);
       curl_setopt ($ch, CURLOPT_HTTPHEADER, $headers);
       curl_setopt ($ch, CURLOPT_PROXY, "myproxyserver.mydomain.com");
       curl_setopt ($ch, CURLOPT_PROXYPORT, 80);
       curl_setopt ($ch, CURLOPT_CUSTOMREQUEST, $method);
       $fetched = curl_exec ($ch);
       $result->code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
       $result->data = $fetched;
       $result->error = curl_errno($ch);
       curl_close($ch);
       return($result);
}

Replace drupal_http_request in GA.lib.inc, with this function curl_http_request. It works for me. YMMV

kumarE’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.