barryhennessy / google-api-php-client

Automatically exported from code.google.com/p/google-api-php-client
Apache License 2.0
0 stars 0 forks source link

Not able to access Publisher's Info #103

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
I am using Google Affiliate Network API 
It is giving 403 forbidden error while my publisher id is correct.
Following is the error i received while trying to access publisher's 
information.

Fatal error: Uncaught exception 'apiServiceException' with message 'Error 
calling GET 
https://www.googleapis.com/gan/v1beta1/publishers/K527935/publishers?key=%09%0D%
0AAIzaSyBanOG7NWQmB0XruIZeC4ylkvXRTKTZvbk: (403) Forbidden' in 
C:\xampp\htdocs\gan\src\io\apiREST.php:86 Stack trace: #0 
C:\xampp\htdocs\gan\src\io\apiREST.php(56): 
apiREST::decodeHttpResponse(Object(apiHttpRequest)) #1 
C:\xampp\htdocs\gan\src\service\apiServiceResource.php(186): 
apiREST::execute(Object(apiServiceRequest)) #2 
C:\xampp\htdocs\gan\src\contrib\apiGanService.php(195): 
apiServiceResource->__call('list', Array) #3 C:\xampp\htdocs\gan\index.php(69): 
PublishersServiceResource->listPublishers('publishers', 'xxxx') #4 {main} 
thrown in C:\xampp\htdocs\gan\src\io\apiREST.php on line 86

Original issue reported on code.google.com by Carousel...@gmail.com on 19 Mar 2012 at 4:42

GoogleCodeExporter commented 8 years ago
You will need to enable the Google Affiliate Network API inside the Google API 
Console.
Here's a link to do it: https://code.google.com/apis/console/?api=gan

Original comment by chirags@google.com on 19 Mar 2012 at 9:31

GoogleCodeExporter commented 8 years ago
I had already enabled google affiliate network api is there any other issue.
Am i need to enable permissions somewhere else.

Original comment by Carousel...@gmail.com on 20 Mar 2012 at 9:59

GoogleCodeExporter commented 8 years ago
When you call $client->setDeveloperKey('insert_your_developer_key'); inside the 
application, do you have any leading characters before the api key?

In the error message, I'm seeing "%09%0D%0A" before your api key.

Original comment by chirags@google.com on 20 Mar 2012 at 5:40

GoogleCodeExporter commented 8 years ago
Yes there was a problem, but i have removed it but problem is still the same

Fatal error: Uncaught exception 'apiServiceException' with message 'Error 
calling GET 
https://www.googleapis.com/gan/v1beta1/publishers/K527935/publishers?key=AIzaSyB
anOG7NWQmB0XruIZeC4ylkvXRTKTZvbk: (403) Forbidden' in 
C:\xampp\htdocs\gan\src\io\apiREST.php:87 Stack trace: #0 
C:\xampp\htdocs\gan\src\io\apiREST.php(56): 
apiREST::decodeHttpResponse(Object(apiHttpRequest)) #1 
C:\xampp\htdocs\gan\src\service\apiServiceResource.php(186): 
apiREST::execute(Object(apiServiceRequest)) #2 
C:\xampp\htdocs\gan\src\contrib\apiGanService.php(195): 
apiServiceResource->__call('list', Array) #3 C:\xampp\htdocs\gan\index.php(68): 
PublishersServiceResource->listPublishers('publishers', 'K527935') #4 {main} 
thrown in C:\xampp\htdocs\gan\src\io\apiREST.php on line 87

Now following is the key I am using as developer key
http://screencast.com/t/wMu7X5uO

I have also tried to use the key which we generate in case of youtube app, I 
think the problem is small only the values may be not getting passed correctly.

and following are settings in my code.

$client = new apiClient();
$client->setApplicationName("My Product");
// Visit https://code.google.com/apis/console?api=gan to generate your
// oauth2_client_id, oauth2_client_secret, and to register your 
oauth2_redirect_uri.
    $client->setClientId('365206530050.apps.googleusercontent.com');
    $client->setClientSecret('e8Q-V2k826UkvUPSPZIk9pQS');
    $client->setRedirectUri('https://localhost/gan/');
    $client->setDeveloperKey('AIzaSyBanOG7NWQmB0XruIZeC4ylkvXRTKTZvbk');
    $scopes = "https://www.googleapis.com/auth/gan.readonly";
    $client->setScopes($scopes);
   $gan = new apiGanService($client); 

Please let me knowif I am doing anything wrong.

Original comment by Carousel...@gmail.com on 22 Mar 2012 at 2:29

GoogleCodeExporter commented 8 years ago
Any thoughts guys?

Original comment by Carousel...@gmail.com on 26 Mar 2012 at 2:41