React.js 应用程序登录 Google,错误 "idpiframe_initialization_failed"
React.js App Login with Google, Error "idpiframe_initialization_failed"
我正在为我的 react.js 应用程序实施使用 Google 登录。我已按照本教程视频中的步骤进行操作:https://youtu.be/75aTZq-qoZk.
我是来自 http://localhost:3000 的 运行 我的应用程序,我已经在 Google Cloud Platform 的“Authorised JavaScript origins”标题下使用我的客户端 ID 注册了它.但是,我仍然收到此错误:
{
"error": "idpiframe_initialization_failed",
"details": "Not a valid origin for the client: http://localhost:3000 has not been registered for client ID. Please go to https://console.developers.google.com/ and register this origin for your project's client ID."
}
这是我的代码:
import React, { Component } from 'react'
import GoogleLogin from 'react-google-login';
export default class Login extends Component {
googleLoginSuccess = (googleData) => {
console.log("Success", googleData);
}
googleLoginFailure = (result) => {
console.log("Failure", result)
}
render() {
return (
<GoogleLogin
clientId={process.env.REACT_APP_GOOGLE_CLIENT_ID}
buttonText="Login"
onSuccess={this.googleLoginSuccess}
onFailure={this.googleLoginFailure}
cookiePolicy={'single_host_origin'}
/>
)
}
}
在隐身标签中试试,
尝试re-create您的凭据,
确保您没有无意中使用 https,
还有:
Note: It may take 5 minutes to a few hours for settings to take effect
我正在为我的 react.js 应用程序实施使用 Google 登录。我已按照本教程视频中的步骤进行操作:https://youtu.be/75aTZq-qoZk.
我是来自 http://localhost:3000 的 运行 我的应用程序,我已经在 Google Cloud Platform 的“Authorised JavaScript origins”标题下使用我的客户端 ID 注册了它.但是,我仍然收到此错误:
{
"error": "idpiframe_initialization_failed",
"details": "Not a valid origin for the client: http://localhost:3000 has not been registered for client ID. Please go to https://console.developers.google.com/ and register this origin for your project's client ID."
}
这是我的代码:
import React, { Component } from 'react'
import GoogleLogin from 'react-google-login';
export default class Login extends Component {
googleLoginSuccess = (googleData) => {
console.log("Success", googleData);
}
googleLoginFailure = (result) => {
console.log("Failure", result)
}
render() {
return (
<GoogleLogin
clientId={process.env.REACT_APP_GOOGLE_CLIENT_ID}
buttonText="Login"
onSuccess={this.googleLoginSuccess}
onFailure={this.googleLoginFailure}
cookiePolicy={'single_host_origin'}
/>
)
}
}
在隐身标签中试试,
尝试re-create您的凭据,
确保您没有无意中使用 https,
还有:
Note: It may take 5 minutes to a few hours for settings to take effect