Google auth2 .getCurrentUser() 获取用户令牌?

Google auth2 .getCurrentUser() get the user token?

我在前端使用 react,在后端使用 nodeJS。

我正在尝试从前端获得 google auth2 登录流程。

我在哪里可以从 google auth2 登录获得令牌?

我在 Zi.access_token 下的回复中看到它,但在我看来这不是正确的获取方式。

为了访问 basic_profileaccess_token 等属性,Auth2 库提供了 getter-functions 的范围,允许您以可预测的方式访问数据

对于 access_token,您应该在成功登录返回的 GoogleUser 对象上调用函数 getAuthResponse(),此 GoogleUser 对象将包含一个明确标记为 access_token

对于basic_profile,提供了GoogleUser.getBasicProfile()


I see it in the response under Zi.access_token but it doesn't seem to me to be the right way to get it.

你是对的,这也许是文档可以提到的。