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

后端 未结 2 889
礼貌的吻别
礼貌的吻别 2020-12-17 06:28

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, hav

相关标签:
2条回答
  • 2020-12-17 06:53

    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.

    0 讨论(0)
  • 2020-12-17 07:13

    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.

    0 讨论(0)
提交回复
热议问题