小编mik*_*eng的帖子

如何使用谷歌一键登录提取用户的完整信息?

我正在尝试为谷歌我的业务创建一个平台,并且我已经实现了一键登录,并且我获得了凭据,但没有获得完整的信息。这是我尝试过的代码

\n
 <script>\n      window.onload = function () {\n        google.accounts.id.initialize({\n          client_id: "clientid.apps.googleusercontent.com",\n          callback: handleCredentialResponse,\n        });\n        google.accounts.id.prompt((notification) => {\n          if (notification.isNotDisplayed() || notification.isSkippedMoment()) {\n            console.log("opted out");\n          }\n        });\n        function handleCredentialResponse(response) {\n           console.log(response)\n          // window.location = "https://github.com/";\n        }\n      };\n    </script>\n
Run Code Online (Sandbox Code Playgroud)\n

这是我收到的回复

\n
{\n  clientId:\n    "clientid.apps.googleusercontent.com",\n  credential:\n    "eyJhbGciOiJSUzI1NiIsImtpZCI6ImYwNTQxNWIxM2FjYjk1OT\xe2\x80\xa640Jk8v3LcOvtopFD_tI2HMlFjg0dK96XrqNiOD0H3Akl",\n  select_by: "user",\n};\n
Run Code Online (Sandbox Code Playgroud)\n

javascript oauth-2.0 google-identity google-my-business-api

5
推荐指数
2
解决办法
4211
查看次数