reactjs - 在 react-google-login 上使用 uxMode="redirect" 时获取 access_token
问题描述
我使用'react-google-login'。我需要将 access_token 发送到后端,当我使用 uxMode="popup" 时,会调用 onSuccess 函数,因此我可以从响应中获取 access_token。
但我想使用 uxMode="redirect"。这是我的代码:
<GoogleLogin
clientId="..."
buttonText="go to sign in"
onSuccess={::this.responseGoogle}
onFailure={::this.errorGoogle}
onRequest={::this.onRequest}
uxMode='redirect'
redirectUri={window.location.origin + '/auth/google/callback'}
/>
它不调用 onSuccess 函数并重定向到“/auth/google/callback”。我无法从 location.hash 中获取此参数(但它具有 id_token)。我可以从什么获得 access_token 并且有可能吗?
解决方案
推荐阅读
- r - 如何将不同功能的输出组合成一份精美的报告?
- c++ - 如何使用包含 C++20 模块的静态库
- python - 有什么方法可以构建一个爬虫,使用 python 从具有不同结构的不同网站获取联系信息?
- x86 - 发送命令时的 ps/2 键盘
- c - XImage深度问题
- java - Android单用户频繁崩溃
- firebase - 如何从firestore获取数据并显示在数据表中?[扑]
- gcloud - 无法运行 Echo Bot Google 消息 API。不回复“card”、“carousel”、“chips”字符串
- json - 如何在颤动中从 JSON 对象中获取特定值?
- handlebars.js - 将 Jekyll 的 Front-matter 变量添加到 Ghost 帖子/页面中