Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not working after installation #5

Open
mrfoh opened this issue Feb 25, 2014 · 17 comments
Open

Not working after installation #5

mrfoh opened this issue Feb 25, 2014 · 17 comments

Comments

@mrfoh
Copy link

mrfoh commented Feb 25, 2014

I just install the package via composer, and config it with the correct parameters from the google api console.

Route::get('test', function() {
$accounts = Analytics::webproperties()->listManagementWebproperties("~all");
foreach ($accounts as $account){
var_dump($account);
}
});

Navigate to the route displays "This web page is not available" on chrome and "Server not found" on firefox. Am i doing something wrong

@thujohn
Copy link
Owner

thujohn commented Feb 26, 2014

I just tested and it works.

If you just created the account you may need to wait a little.

@mrfoh
Copy link
Author

mrfoh commented Feb 26, 2014

Ok i'll give it sometime

@corazzi
Copy link

corazzi commented May 18, 2014

@mrfoh Did you ever resolve this issue?

I've set up the config with my OAuth credentials and set up the .p12 certificate path.
Then I put the service email as a user on my Analytics console with the ability to Read & Analyse.

However, when I try something such as:

Route::get('test', function() {

    echo "<pre>";
    print_r(Analytics::getAllSitesIds());

});

I get "This webpage is not available" in Chrome, and "The connection was reset" in Firefox. However, I only get this when I'm working on localhost. I tried it fresh on my staging server and everything worked fine. I tried from scratch on localhost to make sure I hadn't made a mistake along the way but I still get the same issue.

How can I get it to work on localhost?

@mrfoh
Copy link
Author

mrfoh commented May 18, 2014

Never got around to figuring it out. Decided to use the google analytics site instead.

Best regards
Patrick Foh

On May 18, 2014, at 2:42 PM, Sacha Corazzi [email protected] wrote:

@mrfoh Did you ever resolve this issue?

I've set up the config with my OAuth credentials and set up the .p12 certificate path.
Then I put the service email as a user on my Analytics console with the ability to Read & Analyse.

However, when I try something such as:

Route::get('test', function() {

echo "<pre>";
print_r(Analytics::getAllSitesIds());

});
I get "This webpage is not available" in Chrome, and "The connection was reset" in Firefox. However, I only get this when I'm working on localhost. I tried it fresh on my staging server and everything worked fine. I tried from scratch on localhost to make sure I hadn't made a mistake along the way but I still get the same issue.

How can I get it to work on localhost?


Reply to this email directly or view it on GitHub.

@thujohn
Copy link
Owner

thujohn commented May 20, 2014

@Sachiano Just tested your code on localhost and it works.

Did you modify the config and put your certificate here ? \app\config\packages\thujohn\analytics

@corazzi
Copy link

corazzi commented May 20, 2014

Yep, that's where I put the certificate.

Here's my config file:

<?php

return array(

    'client_id'        => 'xxx.apps.googleusercontent.com',

    'service_email'    => '[email protected]',

    'certificate_path' => __DIR__ . '/certificate.p12',

    'use_objects'      => true,
);

Obviously "xxx" is my actual client id/service email.

I know the certificate is being picked up because if I change the name in the config file to a false file, the certificate not found exception is thrown.

@thujohn
Copy link
Owner

thujohn commented May 20, 2014

Maybe the problem comes from your key.

Did you check it in the google console ?
In "Public API access" you have "Referers"

@corazzi
Copy link

corazzi commented May 21, 2014

@thujohn Here's my API Credentials page

image

I generated a Public API access key and put in local IPs... but I'm not using that key anywhere?

@thujohn
Copy link
Owner

thujohn commented May 21, 2014

Can you try to create a new key ?

Type : Browser key
Referers : leave empty

@corazzi
Copy link

corazzi commented May 21, 2014

API key xxxxxxxxxxxxxxx
Referers     Any referer allowed
Activation date May 21, 2014 2:17 PM
Activated by     [email protected] (you)

It still hasn't worked. Is there anywhere I should be putting that API key?

@thujohn
Copy link
Owner

thujohn commented May 21, 2014

I'm sorry but I don't know...

@thujohn
Copy link
Owner

thujohn commented May 21, 2014

If you can send me your infos/certificate I will test on my local config

@corazzi
Copy link

corazzi commented May 22, 2014

Haha me either! I will send you the info, thanks.

@amanySaad
Copy link

I'm Facing The Same Problem ...Can Any One Help Me

@itarafath
Copy link

me too facing same issure.plz anyone help to resolve this..im working in local.

@barthicus
Copy link

I have the same problem. Config file is correct but simple requests like:

echo Analytics::getSiteIdByUrl('http://github.com/');

generate "This webpage is not available" error in Chrome browser. I'm working on localhost xampp + vhost.

Any suggestions?

EDIT:
I think I found an answer on stackoverflow: post

It seems that, despite ambiguous documentation, most Google APIs do not support service accounts yet, including Google Analytics. They cannot digest OAuth2 tokens returned by a .p12 signed JWT request. So, as of right now, you cannot use Google Analytics API V3 with a service account.

When I check this solution (using CURL) on my example i will tell you does it works.

@snky1987
Copy link

snky1987 commented Oct 9, 2014

Bump. I got exactly same issue as user one post before me.

Edit: Do not do it locally :) I uploaded everything to dev server (accessible form the internet) and it works perfectly.

@ghost ghost mentioned this issue Dec 19, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants