On the line:
onSuccess={() => this.responseGoogle}
How do I change this from being undefined (so that react-google-login works)?
import GoogleLogin from 'react-google-login';
const responseGoogle = (response) => {
var profile = response["profileObj"];
var email = profile["email"];
if (email.includes('@domain.com')) {
this.setState({ permissions: 'internal' });
} else {
this.setState({ permissions: 'external' });
}
}
class Home extends React.Component {
constructor(props) {
super(props);
this.state = { permissions: 'none' };
}
render(){
return (
<GoogleLogin
clientID = secret
buttonText = "Log In with Google!"
theme = "dark"
cookiePolicy = {'single_host_origin'}
onSuccess = {() => this.responseGoogle}
/>
);
}
}
Exact same question as React Google Login and Trouble accessing props in callback function of Google Login using react-google-login. Responses to those questions don't solve the issue (this still undefined).
Thank you very much for your thoughts!!