我正在尝试将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)