1

i have this specific problem: i have tried google api from their examples, but i receive response with error: "Access Not Configured. Please use Google Developers Console to activate the API for your project." i have enabled google plus api in console i regenerated client_id, OAuth and public API key for my browser aplication. here is the code:

<!--Add a button for the user to click to initiate auth sequence -->
<button id="authorize-button" style="visibility: hidden">Authorize</button>

<script type="text/javascript">

var clientId = '111111111-XXXXXXXXXXXXXXXXXXXXXXXXXXXX.apps.googleusercontent.com';

var apiKey = 'YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY'; // browser key

var scopes = 'https://www.googleapis.com/auth/plus.me';

function handleClientLoad() {
    // Step 2: Reference the API key
    gapi.client.setApiKey(apiKey);
    window.setTimeout(checkAuth,1);
}

function checkAuth() {
    gapi.auth.authorize({client_id: clientId, scope: scopes, immediate: true}, handleAuthResult);
}

function handleAuthResult(authResult) {
    var authorizeButton = document.getElementById('authorize-button');
    if (authResult && !authResult.error) {
        authorizeButton.style.visibility = 'hidden';
        makeApiCall();
    } else {
        authorizeButton.style.visibility = '';
        authorizeButton.onclick = handleAuthClick;
    }
}

function handleAuthClick(event) {
    // Step 3: get authorization to use private data
    gapi.auth.authorize({client_id: clientId, scope: scopes, immediate: false}, handleAuthResult);
    return false;
}

// Load the API and make an API call.  Display the results on the screen.
function makeApiCall() {
    // Step 4: Load the Google+ API
    gapi.client.load('plus', 'v1', function() {
        // Step 5: Assemble the API request
        var request = gapi.client.plus.people.get({
            'userId': 'me'
        });
        // Step 6: Execute the API request
        request.execute(function(resp) {
            var heading = document.createElement('h4');
            var image = document.createElement('img');
            console.log(resp);
            image.src = resp.image.url;
            heading.appendChild(image);
            heading.appendChild(document.createTextNode(resp.displayName));

            document.getElementById('content').appendChild(heading);
        });
    });
}
</script>
<!-- Step 1: Load JavaScript client library -->
<script src="https://apis.google.com/js/client.js?onload=handleClientLoad"></script>
Michael Cera
  • 143
  • 1
  • 11
  • So, google apis does not work if you want to use both API Key & OAuth. I just commented this line "gapi.client.setApiKey(apiKey);" and code works fine. Thanks to this post http://stackoverflow.com/questions/21208870/google-glass-development-error-403-access-not-configured-please-use-google-d – Michael Cera Aug 04 '14 at 09:12
  • Solution is here: http://stackoverflow.com/questions/21208870/google-glass-development-error-403-access-not-configured-please-use-google-d – Michael Cera Aug 04 '14 at 11:10

0 Answers0