Google+ API“400(错误请求)”和“拒绝在框架中显示......因为它将'X-Frame-Options'设置为'SAMEORIGIN'。错误 [英] Google+ API "400 (Bad Request)" and "Refused to display ... in a frame because it set 'X-Frame-Options' to 'SAMEORIGIN'." errors

查看:261
本文介绍了Google+ API“400(错误请求)”和“拒绝在框架中显示......因为它将'X-Frame-Options'设置为'SAMEORIGIN'。错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将G + API与我的网站进行整合,并遇到问题。如果您在加载页面时查看控制台,您将看到以下错误:

  GET https://accounts.google .com / o / oauth2 / postmessageRelay?parent = http%3A%2F%2Fwww.pricewombat.com 400(Bad Request)cb = gapi.loaded_0:436 

拒绝显示'https:// accounts.google.com/o/oauth2/postmessageRelay?parent=http%3A%2F%2Fwww.pricewombat.com#rpctoken=356505585&forcesecure=1',因为它将'X-Frame-Options'设置为'SAMEORIGIN 。

我只是使用Google网站上提供的示例代码:

 < script type =text / javascript> 
(function(){
var po = document.createElement('script'); po.type ='text / javascript'; po.async = true;
po.src =' https://apis.google.com/js/client:plusone.js?onload=googlePlusOnloadCallback';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
})();
< / script>

如果我运行 gapi.auth.signIn()

是什么导致了这个问题,我该如何解决它?



更新:



我在我的网站上创建了一个空白页,其中包含以下准系统代码:

 <!DOCTYPE html> 
< html>
< head>
< meta charset =UTF-8>
< / head>
< body>

< script type =text / javascript>
(function(){
var po = document.createElement('script'); po.type ='text / javascript'; po.async = true;
po.src =' http://apis.google.com/js/client:plusone.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po,s);
})();
< / script>
< / body>
< / html>

我尝试加载上面的页面,但没有验证元标记(上面没有显示)获取错误。

看起来这个是Google的问题,因为我只是使用最基本的准系统示例代码它不起作用。

好吧,显然Google+只是有一个brainfart或什么的,因为解决方案只是为了清除我的cookie !

我尝试在另一台计算机上使用我的网站,并且Google+ API工作正常(没有错误),所以我尝试清除桌面上的cookie并注意,开始工作!

I am trying to integrate the G+ API with my website and am having a problem. If you look at the console when loading the page, you will see the following errors:

GET https://accounts.google.com/o/oauth2/postmessageRelay?parent=http%3A%2F%2Fwww.pricewombat.com 400 (Bad Request) cb=gapi.loaded_0:436

Refused to display 'https://accounts.google.com/o/oauth2/postmessageRelay?parent=http%3A%2F%2Fwww.pricewombat.com#rpctoken=356505585&forcesecure=1' in a frame because it set 'X-Frame-Options' to 'SAMEORIGIN'.

I'm just using the example code given on Google's website:

<script type="text/javascript">
    (function() {
        var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
        po.src = 'https://apis.google.com/js/client:plusone.js?onload=googlePlusOnloadCallback';
        var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
    })();
</script>

If I run gapi.auth.signIn() in the console, nothing happens. I'm assuming the problem is related to the above errors when the page loads.

What's causing this problem and how do I fix it?

UPDATE:

I created a blank page on my website with this barebones code:

<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
</head>
<body>

<script type="text/javascript">
    (function() {
        var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
        po.src = 'http://apis.google.com/js/client:plusone.js';
        var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
    })();
</script>
</body>
</html>

I tried loading the above page with and without the authentication meta tags (not shown above) and am still getting the errors.

It seems like this has to be a problem on Google's end since I'm just using the most basic barebones example code and it's not working.

解决方案

Well, apparently Google+ just had a brainfart or something, because the solution was simply to clear my cookies!

I tried using my website on another computer and the Google+ API worked fine (no errors), so I tried clearing the cookies on my desktop and lo and behold, it started working!

这篇关于Google+ API“400(错误请求)”和“拒绝在框架中显示......因为它将'X-Frame-Options'设置为'SAMEORIGIN'。错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆