我使用'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?这可能吗?
1条答案
按热度按时间oalqel3c1#
我在服务器端(节点js)使用这段代码来动态处理具有ID令牌的情况和具有ACCESS令牌的情况。