Refuse to display
Diani Djsu <[email protected]>
| Newsgroups | gmane.comp.web.blogger.api |
|---|---|
| Message-ID | <[email protected]> |
I want to make a page to handle some of my blogger stuff and started to try
and figure out the API. I got everything setup and have even tested
successfully a sample code and decided to edit that code as a starting
place. Thing is I can't get it to work with blogger I keep getting "Refused
to display 'https://accounts.google.com/o/oauth2/auth?....' in a frame
because it set 'X-Frame-Options' to 'SAMEORIGIN'.
I can't seem to get past this error, I have tested the responses in the
oauth playground console and even in the api explorer and it runs fine in
those two but I keep getting the error. Heres the code:
Enter code here...
<!--
Copyright (c) 2011 Google Inc.
Licensed under the Apache License, Version 2.0 (the "License"); you may
not
use this file except in compliance with the License. You may obtain a
copy of
the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
License for the specific language governing permissions and limitations
under
the License.
To run this sample, replace YOUR API KEY with your application's API key.
It can be found at https://code.google.com/apis/console/?api=plus under
API Access.
Activate the Google+ service at https://code.google.com/apis/console/
under Services
-->
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8' />
</head>
<body>
<!--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">
// Enter a client ID for a web application from the Google Developer
Console.
// The provided clientId will only work if the sample is run directly
from
//
https://google-api-javascript-client.googlecode.com/hg/samples/authSample.html
// In your Developer Console project, add a JavaScript origin that
corresponds to the domain
// where you will be running the script.
var clientId = '';
// Enter the API key from the Google Develoepr Console - to handle
any unauthenticated
// requests in the code.
// The provided key works for this sample only when run from
//
https://google-api-javascript-client.googlecode.com/hg/samples/authSample.html
// To use in your own application, replace this API key with your own.
var apiKey = '';
// To enter one or more authentication scopes, refer to the
documentation for the API.
var scopes = 'https://www.googleapis.com/blogger/v3';
// Use a button to handle authentication the first time.
function handleClientLoad() {
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) {
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() {
gapi.client.load('blogger', 'v3', function() {
var request = gapi.client.blogger.blogs.listByUser({
'userId' : 'self'
});
request.execute(function(resp) {
var heading = document.createElement('h4');
heading.appendChild(document.createTextNode(resp.displayName));
document.getElementById('content').appendChild(heading);
});
});
}
</script>
<script
src="https://apis.google.com/js/client.js?onload=handleClientLoad"></script>
<div id="content"></div>
<p>Retrieves your profile name using the Google Plus API.</p>
</body>
</html>
--
You received this message because you are subscribed to the Google Groups "Blogger Developer Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/bloggerdev.
For more options, visit https://groups.google.com/d/optout.