我正在尝试实现谷歌登录与反应-谷歌-登录。我使用http://localhost:3000和https://localhost:3000设置凭据。并且这个错误:‘idpiframe_initialization_failed’仍然显示在控制台中。
这是错误
{error: 'idpiframe_initialization_failed', details: 'You have created a new client application that use…i/web/guides/gis-migration) for more information.'}
details: "You have created a new client application that uses libraries for user authentication or authorization that will soon be deprecated. New clients must use the new libraries instead; existing clients must also migrate before these libraries are deprecated. See the [Migration Guide](https://developers.google.com/identity/gsi/web/guides/gis-migration) for more information."
error: "idpiframe_initialization_failed"
[[Prototype]]: Object
constructor: ƒ Object()
hasOwnProperty: ƒ hasOwnProperty()
isPrototypeOf: ƒ isPrototypeOf()
propertyIsEnumerable: ƒ propertyIsEnumerable()
toLocaleString: ƒ toLocaleString()
toString: ƒ toString()
valueOf: ƒ valueOf()
__defineGetter__: ƒ __defineGetter__()
__defineSetter__: ƒ __defineSetter__()
__lookupGetter__: ƒ __lookupGetter__()
__lookupSetter__: ƒ __lookupSetter__()
__proto__: (...)
get __proto__: ƒ __proto__()
set __proto__: ƒ __proto__()
这是密码
<GoogleLogin
clientId="CLIENT_ID.apps.googleusercontent.com"
render={(renderProps) => (
<Button className={classes.googleButton} color="primary" fullWidth onClick={renderProps.onClick} disabled={renderProps.disabled} startIcon={<Icon />} variant="contained"
>Google Sing in</Button>
)}
onSuccess={googleSuccess}
onFailure={googleFailure}
cookiePolicy="single_host_origin"
/>
发布于 2022-06-08 17:42:53
为我工作:
在匿名标签里试一试,
试着重新创建你的证书,
确保你没有意外地使用https,
注意:
It may take 5 minutes to a few hours for settings to take effect
或
试试这个:
默认情况下,新创建的客户端ID现在被阻止使用旧平台库,现有客户端ID不受影响。2022年7月29日之前创建的新客户端ID可以设置plugin_name以启用。
因此,就我而言,解决办法是:
window.gapi.load('client:auth2', () => {
window.gapi.client.init({
clientId: '******.apps.googleusercontent.com',
plugin_name: "chat"
})
https://stackoverflow.com/questions/72549874
复制相似问题