如何使用Google一键式登录获取个人资料和用户信息

问题描述

我正在尝试使用Google一键式登录获取个人资料信息,并且我正在获取clientId和凭据而不是用户个人资料,并且我也使用了其他gapi方法,但是我无法获得,有人可以建议如何提取

<!DOCTYPE html>
<html lang="en">
  <head>
    <Meta charset="UTF-8" />
    <Meta name="viewport" content="width=device-width,initial-scale=1.0" />
    <title>Document</title>
    <script src="https://apis.google.com/js/platform.js" async defer></script>
    <script src="https://accounts.google.com/gsi/client" async defer></script>
    <script src="https://apis.google.com/js/client.js?onload=authorize"></script>
    <script src="https://www.gstatic.com/firebasejs/5.0.3/firebase-app.js"></script>
    <script src="https://www.gstatic.com/firebasejs/5.0.3/firebase-firestore.js"></script>
  </head>
  <body>
    <div
      id="g_id_onload"
      data-client_id="xxxxxx"
      data-callback="handleCredentialResponse"
    ></div>
    <script>
      function handleCredentialResponse(response) {
        console.log(response);
        auth2 = gapi.auth2.init({
          client_id: "xxxxxx",scope:
            "email profile https://www.googleapis.com/auth/plus.business.manage",prompt: "none",});
        auth2.signIn().then(function () {
          console.log(auth2.currentUser);
        });
        auth2
          .grantOfflineAccess({
            scope:
              "email profile https://www.googleapis.com/auth/plus.business.manage",})
          .then(async function (resp) {
            var auth_code = resp.code;
            // here i am getting the authorization code 
          });
      }
    </script>
  </body>
</html>

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...