小编Pra*_*sal的帖子

React google登录返回错误“idpiframe_initialization_failed”

我尝试使用react-google-login包实现谷歌登录。我已经将客户端 ID 也放入了正确的 URL http://localhost:3000 和 https://localhost:3000。但我一直收到错误消息“idpiframe_initialization_failed”和如下详细信息的问题: 您创建了一个新的客户端应用程序,该应用程序使用库进行用户身份验证或授权,但很快就会被弃用。新客户必须使用新库;在这些库被弃用之前,现有的客户端也必须迁移。我真的很困惑。请花点时间帮助我解决这一问题。谢谢。

在此输入图像描述

            <header className="App-header">
                <h1>React Google Login App</h1>
                <div>
                    {loginData ? (
                        <div>
                            <h3>You logged in as {loginData.email}</h3>
                            <button onClick={handleLogout}>Logout</button>
                        </div>
                    ) : (
                        <GoogleLogin
                            clientId={"846142574809-apbj2h6v9upultr3qvfskn6kfght9udb.apps.googleusercontent.com"}
                            buttonText="Log in with Google"
                            onSuccess={handleLogin}
                            onFailure={handleFailure}
                            cookiePolicy={'single_host_origin'}
                        ></GoogleLogin>
                    )}
                    <GoogleLogout clientId='846142574809-apbj2h6v9upultr3qvfskn6kfght9udb.apps.googleusercontent.com' buttonText='logout' onLogoutSuccess={handleoutSuccess}></GoogleLogout>

                </div>
            </header>
        </div>```
Run Code Online (Sandbox Code Playgroud)

reactjs google-signin react-google-login

5
推荐指数
1
解决办法
1万
查看次数