【发布时间】:2020-07-21 14:36:12
【问题描述】:
<script src="https://accounts.google.com/gsi/client"></script>
...
declare var google: any;
...
useEffect(() => {
const handleCredentialResponse = (response: any) => {
console.log(response);
};
const client_id = process.env.REACT_APP_GOOGLE_CLIENT_ID;
const callback = handleCredentialResponse;
const auto_select = true;
google.accounts.id.initialize({ client_id, callback, auto_select });
google.accounts.id.prompt((notification: any) => {
console.log(notification);
});
}, []);
为什么handleCredentialResponse 根本不被调用?提示用户登录,他们点击继续,然后该函数永远不会被调用!呸!以上取自docs here和also here
notification 注销
nl {g: "display", h: true}
nl {g: "skipped", l: "issuing_failed"}
【问题讨论】:
-
嗨@Bill,你从哪里引用了这段代码?根据文档,我只能看到此代码
-
这里的谷歌变量是什么?
标签: reactjs google-oauth