Google Glass Development Error: (403) Access Not Configured. Please use Google Developers Console to activate the API for your project
Asked Answered
D

2

2

I am using the PHP version of the Google Glass Developer Kit. Setup everything per the sample code instructions. API/credentials are all fine, account billing is setup, have added the Mirror API to the project, but after I permission the application, I get the following Error:

An error ocurred: Error calling POST 
https://www.googleapis.com/mirror/v1/timeline?key=xxxxxx 
(403) Access Not Configured. 
Please use Google Developers Console to activate the API for your project.

I have added the Mirror API and have Billing active and setup so have no idea why i am getting the error message. Testing the app via the Glass Explorer works just fine.

Doggett answered 18/1, 2014 at 19:33 Comment(0)
D
9

Google APIs have been known to misbehave when you provide both OAuth2 credentials and an API Key. Also since you have to use OAuth2 to access the Mirror API, the key=xxxxx isn't necessary anyway.

If you are using the Google APIs Client Library for PHP you can simply remove the following line from your code:

 $client->setDeveloperKey($key);

Not entirely sure if this causes your issue, but I have come across similar issues in other Google APIs.

Dogcatcher answered 18/1, 2014 at 21:16 Comment(5)
Wow..that did the trick, who would have thought! Commented that out of mirror-client.php and now works like a breeze. Oh well, half a Saturday wasted.Doggett
I have the same error but this didn't resolve it. I still have a 403 after commenting out the //public function setDeveloperKey($key) {$this->key = $key;} in google-api-php-client/src.Cordie
stanzheng - did you 1) make sure the Mirror API was added to your list of API and 2) make sure you had billing information added to your account (not sure if this is necessary but have read in places that this may have something to do with it)Doggett
Thanks a lot Scarygami. This solved my problem. Google does need to update their terrible docs.Blackamoor
This solved my problem too. I'm curious as to why google would release a php starter project for google glass and not address this issue?Rog
D
2

In Google API console for your project (https://code.google.com/apis/console/)

Make sure that your "Public API access" or "Key for server application" has allowed the IP address of your server.

Also make sure you have the proper "Redirect URIs", if you get refused, look at your php logs, I had this:

PHP Fatal error:  Uncaught exception 'Google_ServiceException' with message 'Error calling GET https://www.googleapis.com/mirror/v1/timeline?maxResults=3&key=: (403) Access Not Configured. Please use Google Developers Console to activate the API for your project.'    

use your $base_url + /oauth2callback.php to find out what the correct Redirect URI is.

I managed to solve the issue by adding the IP address and REDIRECT URIs and it runs both on my local machine and on the server. (same code, same key)

PS: I want to thank Scarygami, disabling the $client->setDeveloperKey($key); helped me find the solution.

Dermot answered 19/1, 2014 at 0:0 Comment(2)
So under "Public API Access" do you have 2 keys or 1 key? I only have one ("Key for browser applications"). Am curious if you have 2 keys or are using "Server Key" only instead of a "Browser"Doggett
yes, "Public API Access" has 2 keys, "Client ID" and "Client secret". Whereas on "Public API access - Key for server applications" has 1 key, your "API key". This solved my issue, hope it helps you get going!Dermot

© 2022 - 2024 — McMap. All rights reserved.