Google Plus共享和使用Google Plus登录消失了

Google Plus share and Sign in with Google plus disappeared

本文关键字:Google Plus 登录 消失了 共享      更新时间:2023-09-26

我已经在我的网站上登录了googleplus。它运行良好,并按照官方教程执行(https://developers.google.com/+/web/signin/)作为

class="g-signin"
data-callback="onSignInCallback"
data-clientid=<my id>
data-approvalprompt="force"
data-width="wide"
data-cookiepolicy="http://<?php echo $c_site; ?>.com"
data-requestvisibleactions="http://schemas.google.com/AddActivity"
data-scope="https://www.googleapis.com/auth/plus.login       https://www.googleapis.com/auth/userinfo.email">
</span>

在官方网站上以各自的js客户端为例进行了编码几周前它消失了。与此同时,我在google+按钮上的分享也消失了。这也是有效的,并根据官方网站进行编码https://developers.google.com/+/web/share/

                <div class="g-plus" data-action="share" data-annotation="none" displayText="<?php echo $someBullshit;?>" data-href="<?php echo $url;?>" ></div>

我不会在这里详细介绍,因为我的代码是逐字逐句地从教程中复制的。有人看到明显的东西了吗?g+api是否发生了严重变化?教程似乎没有改变

您的plusone.js include可能出了什么问题?确保这是在你的页面上,就在你的关闭体标签:之前

<!-- Place this asynchronous JavaScript just before your </body> tag -->
<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';
   var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
 })();
</script>

要测试它是否已加载,请打开JavaScript控制台并测试是否存在gap对象:

gapi.plus.render

其次,看起来您的容器(跨度)没有打开标签。它应该读作:

<span class="g-signin"
  data-callback="onSignInCallback"
  data-clientid=<my id>
  data-approvalprompt="force"
  data-width="wide"
  data-cookiepolicy="single_host_origin"
  data-requestvisibleactions="http://schemas.google.com/AddActivity"
  data-scope="https://www.googleapis.com/auth/plus.login       https://www.googleapis.com/auth/userinfo.email">

最后,注意你设置cookiepolicy的方式。如果配置不正确,脚本将被阻止加载。尝试将其更改为single_host_origin,看看是否设置不正确(通常应该是http://yoursite.com或https://yoursite.comhttps和http会有所不同)。