Sign in with Google for React Native

https://thoughtbot.com/blog/sign-in-with-google-for-react-native

We just released @thoughtbot/react-native-social-auth; a modern Google Sign-In library for React Native built on top of Android’s Credential Manager and the current GoogleSignIn-iOS SDK. It ships with a Google-branding-compliant button component, a first-party Expo config plugin, and a TypeScript-first API.

import {
  GoogleSignIn,
  GoogleSignInButton,
} from '@thoughtbot/react-native-social-auth';

GoogleSignIn.configure({
  webClientId: 'YOUR_WEB_CLIENT_ID.apps.googleusercontent.com',
  iosClientId: 'YOUR_IOS_CLIENT_ID.apps.googleusercontent.com',
});

<GoogleSignInButton
  onPress={async () => {
    const credential = await GoogleSignIn.signIn();
    console.log(credential.user.email);
  }}
/>

That’s the whole surface for a happy-path sign-in.

Google has been modernizing its Sign in with Google stack on both Android and iOS.

On Android, the legacy GoogleSignInClient API from Google Play services is deprecated and will be removed in a future release. Google recommends migrating authentication flows to Credential Manager, a unified API for passwords, passkeys, and federated identity providers, including Sign in with Google. It is the recommended approach for new Android apps implementing authentication.

On iOS, version 8 of the Google Sign-In SDK added Firebase App Check support, which helps verify that sign-in requests originate from an authentic instance of the app. Version 9 added support for supplying a custom cryptographic nonce. When the nonce is validated by the server, it helps bind the ID token to a specific authentication request and protect against replay attacks. Together, these features strengthen the security of the authentication flow. See Google’s iOS SDK release notes and OpenID Connect documentation.

Many existing React Native libraries still target the previous generation of Android APIs or older versions of the iOS SDK. Although they may continue to support basic Sign in with Google flows, Android integrations built on the deprecated API will eventually need to migrate. Apps using older integrations also miss newer platform capabilities such as Credential Manager’s bottom-sheet interface, automatic sign-in, and structured error handling.

We built react-native-social-auth to close that gap.

About thoughtbot

We've been helping engineering teams deliver exceptional products for over 20 years. Our designers, developers, and product managers work closely with teams to solve your toughest software challenges through collaborative design and development. Learn more about us.