Hi all.
Please understand if my English and explanation is not so fluent. I’m on 2-weeks projects with my teammates in an web coding boot camp, and I can’t find a solution using Expo.Google signin verification. Any reference or experience solving it would be appreciated.
Here’s my reproduction procedure.
- open android expo app.
- tap scan QR code.
- scan QR code on metro bundler.
- when my testing app opens, tap signin button
- this opens webview and ask me the permission to access on my account.
- accepting it my phone immediately returns to expo app not my testing app, I tried to reach my testing app and it is still there, but I tap the signin button again, it says the app crashed.
- the error on my editor: In Progress error: Error: cannot set promise - some async operation is still in progress .
BTW, I’m using windows 10, galaxy a6, metro bundler for testing and the project is not yet ejected.
my code
import * as Expo from 'expo';
export default class HomeScreen extends React.Component {
constructor(props) {
super(props)
}
signInWithGoogleAsync = async () => {
try {
const result = await Expo.Google.logInAsync({
androidClientId: 'secret.apps.googleusercontent.com',
//iosClientId: YOUR_CLIENT_ID_HERE,
scopes: ['profile', 'email'],
});
if (result.type === 'success') {
alert('aaaa')
return result.accessToken;
} else {
return {cancelled: true};
}
} catch(e) {
return {error: true};
}
}
onLoginPress = async () => {
const result = await this.signInWithGoogleAsync()
alert(JSON.stringify(result));
// if there is no result.error or result.cancelled, the user is logged in
// do something with the result
}
static navigationOptions = {
title: 'Home'
};
render() {
return (
<View>
<Text>aaaaaaaaaaaaa</Text>
<Button title="Sign in with Google" onPress={this.onLoginPress} />
<Button title="gotomap" onPress={() => this.props.navigation.navigate('MapScreen')}></Button>
<Button title="check" onPress={() => this.checked()}></Button>
</View>
)
}
}
Thanks again for your help.