How to use the expo-google-sign-in.signInSilentlyAsync 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.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

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 3 years ago

Package Health Score

36 / 100
Full package analysis

Similar packages