I am currently using the following module to implement a Google signin: react-native-google-signin.
I create the button and when pressed am able to select a google account to log in with, however upon selecting an account I get the following error: WRONG SIGNIN Error: DEVELOPER_ERROR at new GoogleSigninError It looks as though a user object is not being created upon signin. I followed the tutorial pretty thoroughly, is there something I'm not accounting for? Relevant code:
constructor(props){
super(props);
this.state = {
user: null,
}
}
componentDidMount() {
this._setupGoogleSignin();
}
_signIn() {
GoogleSignin.signIn()
.then((user) => {
console.log(user);
this.setState({user: user});
this.props.navigator.push({
component: Account
});
})
.catch((err) => {
console.log('WRONG SIGNIN', err);
})
.done();
}
async _setupGoogleSignin() {
try {
await GoogleSignin.hasPlayServices({ autoResolve: true });
await GoogleSignin.configure({
webClientId: 'MY-CLIENT-ID',
offlineAccess: false
});
const user = await GoogleSignin.currentUserAsync();
console.log(user);
this.setState({user});
}
catch(err) {
console.log("Play services error", err.code, err.message);
}
}
Within render:
<GoogleSigninButton
style={{width: 312, height: 48}}
size={GoogleSigninButton.Size.Wide}
color={GoogleSigninButton.Color.Light}
onPress={() => { this._signIn(); }}/>