How to use the expo-google-sign-in.getPhotoAsync function in expo-google-sign-in

To help you get started, we’ve selected a few expo-google-sign-in examples, based on popular ways it is used in public projects.

github expo / expo / apps / native-component-list / src / screens / GoogleSignInScreen.tsx View on Github external
_syncUserWithStateAsync = async () => {
    /*
      const user = await GoogleSignIn.signInSilentlyAsync();
      this.setState({ user });
    */

    if (await GoogleSignIn.signInSilentlyAsync()) {
      const photoURL = await GoogleSignIn.getPhotoAsync(256);
      const user = await GoogleSignIn.getCurrentUserAsync();
      if (user) {
        this.setState({
          user: {
            ...user.toJSON() as { displayName: string, email: string },
            photoURL: photoURL || user.photoURL!,
          },
        });
      }
    } else {
      this.setState({ user: undefined });
    }
  }

expo-google-sign-in

Deprecated Expo module to enable native Google authentication

MIT
Latest version published 5 months ago

Package Health Score

39 / 100
Full package analysis

Similar packages