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

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

问题描述

我正在尝试将 G+ API 与 我的网站 集成,但遇到了问题.如果在加载页面时查看控制台,会看到以下错误:

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'.

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

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>

如果我在控制台中运行 gapi.auth.signIn(),没有任何反应.我假设问题与页面加载时的上述错误有关.

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?

更新:

我用这个准系统代码在我的网站上创建了一个空白页面:

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.

这似乎必须成为 Google 的问题,因为我只是使用最基本的准系统示例代码,但它不起作用.

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.

推荐答案

好吧,显然 Google+ 只是脑残什么的,因为解决方案只是清除我的 cookie!

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

我尝试在另一台计算机上使用我的网站,并且 Google+ API 运行良好(没有错误),所以我尝试清除桌面上的 cookie,瞧,它开始工作了!

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天全站免登陆