相关疑难解决方法(0)

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

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'.
Run Code Online (Sandbox Code Playgroud)

我只是使用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>
Run Code Online (Sandbox Code Playgroud)

如果我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 = …
Run Code Online (Sandbox Code Playgroud)

google-api google-authentication google-plus

7
推荐指数
1
解决办法
5401
查看次数