I already tried installing:
expo-google-app-auth
expo-app-auth
nothing working
This is my code:
import React, {Component} from ‘react’;
import { View, StyleSheet, Button } from ‘react-native’;
import firebase from ‘firebase’;
class LoginScreen extends Component{
signInWithGoogleAsync = async() => {
try {
const result = await Expo.Google.logInAsync({
behavior: ‘web’,
// androidClientId: YOUR_CLIENT_ID_HERE,
iosClientId: ‘XXXX’,
scopes: [‘profile’, ‘email’],
});
if (result.type === 'success') {
this.onSignIn(result);
return result.accessToken;
} else {
return { cancelled: true };
}
} catch (e) {
alert(e)
}
};
render() {
return (
<View style={styles.container}>
<Button
title="Sign In With Google"
onPress= {() => this.signInWithGoogleAsync()} />
</View>
);
}
}
export default LoginScreen;
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: ‘#fff’,
alignItems: ‘center’,
justifyContent: ‘center’,
},
});