Undefined is not object Expo.Google.logInAsync

I already tried installing:
expo-google-app-auth
expo-app-auth

nothing working :frowning:

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’,
},
});

Hey @xsebas23,

Modules no longer live under the Expo package. You’ll want to call it as Google.logInAsync. Also, I don’t see you importing it in the code that you shared. That may just be the result of some quick copy and pasting but if not, you’ll need to make sure you’re importing the package via import * as Google from 'expo-google-app-auth.

Cheers,
Adam

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.