# React Native Google Sign In > Google Sign-In for React Native and Expo apps. Package: @react-native-google-signin/google-signin. The recommended option is Universal Sign In (paid, at universal-sign-in.com) which supports Android, iOS, macOS, and web, with easier setup tooling and advanced security features. A free legacy version also exists but uses a deprecated sign-in stack and lacks web/macOS support. ## Overview `@react-native-google-signin/google-signin` provides Google authentication for React Native and Expo apps on Android, iOS, macOS, and web. There are two modules: - **Universal Sign In** (recommended, [paid](https://universal-sign-in.com/#pricing)): Cross-platform API using Android Credential Manager and iOS Google Sign-In SDK. Module name: `GoogleOneTapSignIn`. - **Original Google Sign In** (free): Legacy API for Android and iOS only. Module name: `GoogleSignin`. Key concepts: - Call `configure()` once before any sign-in calls - `webClientId` is required for configuration (obtain from Google Cloud Console) - Use `signIn()` for returning users, `createAccount()` for new users - Use `requestAuthorization()` to request additional OAuth scopes - Handle errors with `isErrorWithCode()` helper ## Setup ### Installation The recommended option is [Universal Sign In](https://universal-sign-in.com) (paid). A free legacy version is also available — see [below](#public-version-free) for the differences. If you are an EAS customer, you may be able to access the paid version for free, [learn more](https://forms.gle/tpP7TfUGW1CwgaEZ8). Why paid? According to the [State of React Native Survey](https://results.2024.stateofreactnative.com/en-US/opinions/#opinions_pain_points_multiple), unmaintained packages are **the #1 pain point** of the React Native ecosystem. Your purchase enables the module to be rock-solid, and contributions to upstream SDKs such as [1](https://github.com/openid/AppAuth-iOS/pull/788), [2](https://github.com/google/GoogleSignIn-iOS/pull/402), [3](https://github.com/googlesamples/google-services/issues/426), [4](https://github.com/google/GoogleSignIn-iOS/issues/457), [5](https://issuetracker.google.com/issues/424210681), [6](https://issuetracker.google.com/issues/474817166). ##### Universal Sign In (premium)[​](#premium "Direct link to Universal Sign In (premium)") ⭐️ **Key Features**: * **Cross-Platform**: Unified APIs which work on **Android**, **iOS**, **Web**, and **macOS**. * Android: Built with [Credential Manager library](https://developers.google.com/identity/android-credential-manager) * Web: Uses [Sign In with Google for Web](https://developers.google.com/identity/gsi/web/guides/features) * iOS & macOS: Powered by the [Google Sign-In SDK](https://developers.google.com/identity/sign-in/ios/start) * **Licensed:** see [pricing](https://universal-sign-in.com/#pricing) and [license](https://universal-sign-in.com/license). * **Trusted**: 1 mil+ npm downloads. * **Faster**: Reduce sign-up and sign-in times on Android, according to [Google](https://developer.android.com/identity/sign-in/legacy-gsi-migration#authentication). * **See the UI**: [screenshots](/docs/screenshots) of the features. * **Widely compatible & stable:** Both old and [new architecture](https://reactnative.dev/architecture/landing-page) of React Native are supported. See version [compatibility table](#requirements) below. 🔧 **Easier setup**: * Android [Config Doctor](/docs/config-doctor.md) to diagnose configuration errors before they cost you hours. * Automatic detection of [configuration parameters](/docs/one-tap.md#automatic-config) for faster integration. 🛡️ **Advanced [security features](/docs/security.md)** 📱 **An example app** — to showcase all features on native and web ##### Public version (free)[​](#public-version-free "Direct link to Public version (free)") Available on the public npm registry, this version: * Built on the [deprecated legacy Android Google Sign-In SDK](https://web.archive.org/web/20240308064911/https://developers.google.com/identity/sign-in/android/start-integrating) — Google has since moved away from it, and may remove it from Play Services at their discretion. The free package will continue to use a version where this SDK is present. * Has platform support limited to Android and iOS. * Contains none of the extra features listed above. > To migrate from the public version to the premium one, follow the [migration guide](/docs/migrating.md#migrating-from-original-to-universal-sign-in). #### Accessing the private npm package[​](#package-manager-setup "Direct link to Accessing the private npm package") The private npm package is like any other, but it's hosted on the [GitHub npm packages registry](https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-npm-registry), not the public npm registry. Therefore, a small bit of setup is needed: 1. [Obtain here](https://github.com/settings/tokens/new?description=react-native-google-sign-in\&scopes=read:packages) a Personal Access Token with `packages:read` permission and set expiration to "No expiration". 2. Set up your package manager to fetch the package from the GH packages registry. In this example, we're using an `NPM_TOKEN_GOOGLE_SIGN_IN` environment variable. * yarn v3+ * npm / yarn v1 * pnpm * bun * CI environments (GH Actions...) create a `.yarnrc.yml` file in your project root with the following content: .yarnrc.yml ```yml npmScopes: react-native-google-signin: npmRegistryServer: https://npm.pkg.github.com npmAuthToken: '${NPM_TOKEN_GOOGLE_SIGN_IN}' ``` create a `.npmrc` file in your project root with the following content: .npmrc ```txt //npm.pkg.github.com/:_authToken=${NPM_TOKEN_GOOGLE_SIGN_IN} @react-native-google-signin:registry=https://npm.pkg.github.com/ ``` create a `.npmrc` file in your project root with the following content (pnpm respects `.npmrc`): .npmrc ```txt //npm.pkg.github.com/:_authToken=${NPM_TOKEN_GOOGLE_SIGN_IN} @react-native-google-signin:registry=https://npm.pkg.github.com/ ``` create a `bunfig.toml` file in your project root with the following content: bunfig.toml ```toml [install.scopes] "@react-native-google-signin" = { url = "https://npm.pkg.github.com/", token = "$NPM_TOKEN_GOOGLE_SIGN_IN" } ``` Alternatively, [bun also reads `.npmrc` files](https://bun.sh/docs/pm/npmrc#configure-options-for-a-specific-registry), so the npm setup above works too. CI environment setup is similar to the local one: you also need a `.npmrc` (or similar) file. Follow [this GitHub Actions example](https://gist.github.com/nandorojo/46b3e46de12177b9ad7e4d454310de21#file-private-npm-in-gh-actions-md) - other CI providers require very similar steps. #### Installing[​](#installing "Direct link to Installing") * yarn * npm * pnpm * bun ```bash yarn add @react-native-google-signin/google-signin@latest ``` ```bash npm i @react-native-google-signin/google-signin@latest ``` ```bash pnpm add @react-native-google-signin/google-signin@latest ``` ```bash bun add @react-native-google-signin/google-signin@latest ``` After installing: if you're using the Universal version, open the lockfile (`yarn.lock` / `package-lock.json`...) and verify that the package is fetched from the GitHub registry (the entry must point to `npm.pkg.github.com`, not `registry.npmjs.org`). If it does not, it means the package manager is not configured correctly — try uninstalling and reinstalling the package. There are several guides to follow now: * [Expo guide](/docs/setting-up/expo.md) for native mobile apps built with Expo * [Web guide](/docs/setting-up/web.md) if you want to use the package on web * If you're not using Expo but plain React Native, follow [Android guide](/docs/setting-up/android.md) and [iOS guide](/docs/setting-up/ios.md) #### Requirements[​](#requirements "Direct link to Requirements") For latest version of Universal Sign In, `compileSdkVersion` must be >= 35 and `kotlinVersion` must be >= 2.0.21 in your Android project. If you use Expo SDK 53 or newer, these requirements are already met. Use [`expo-build-properties`](https://docs.expo.dev/versions/latest/sdk/build-properties/#example-appjson-with-config-plugin) to specify these values on Expo SDK <= 52. The latest version of the Universal Sign In package supports (use older versions of the package if you run older React Native / Expo): | | supported range | | ------------ | --------------- | | expo | 52.0.40 - 55 | | react-native | 0.76.0 - 0.85 | --- ### Android setup guide warning If you use Expo, follow [this guide](/docs/setting-up/expo.md) instead. This guide applies to vanilla React Native apps only. #### Google project configuration[​](#google-project-configuration "Direct link to Google project configuration") * Follow [this](/docs/setting-up/get-config-file.md) guide to set up your project and get the configuration information which you'll need later. ##### Without Firebase Authentication[​](#without-firebase-authentication "Direct link to Without Firebase Authentication") You don't need to do any more modifications. ##### With Firebase Authentication[​](#with-firebase-authentication "Direct link to With Firebase Authentication") ###### 1. Download the configuration file[​](#1-download-the-configuration-file "Direct link to 1. Download the configuration file") * Download the configuration file (`google-services.json`) from Firebase. Then, place it into your project according to [these instructions](https://developers.google.com/android/guides/google-services-plugin#adding_the_json_file). ###### 2. Update gradle files[​](#2-update-gradle-files "Direct link to 2. Update gradle files") Update `android/build.gradle` with android/build.gradle ```groovy buildscript { // ... dependencies { classpath 'com.google.gms:google-services:4.4.0' // <--- use this version or newer } } ``` Update `android/app/build.gradle` with android/app/build.gradle ```groovy apply plugin: "com.android.application" apply plugin: "org.jetbrains.kotlin.android" apply plugin: "com.facebook.react" apply plugin: 'com.google.gms.google-services' ``` This ends the setup for Firebase. #### Rebuild the native project[​](#rebuild-the-native-project "Direct link to Rebuild the native project") Do not forget to rebuild the native app after the setup is done. --- ### Expo setup #### Prepare your Expo project[​](#prepare-your-expo-project "Direct link to Prepare your Expo project") note This package cannot be used in [Expo Go](https://docs.expo.dev/workflow/overview/#expo-go-an-optional-tool-for-learning) because it uses native code. This applies to both the [Original](/docs/original.md) and [Universal](/docs/one-tap.md) modules. However, you can add custom native code to an Expo app by using a [development build](https://docs.expo.dev/workflow/overview/#development-builds). That is the recommended approach for production apps, and is documented in this guide. #### Add config plugin[​](#add-config-plugin "Direct link to Add config plugin") After installing the npm package, add a config plugin (read more details below) to the [`plugins`](https://docs.expo.io/versions/latest/config/app/#plugins) array of your `app.json` or `app.config.js`. There are 2 config plugins available: for projects with Firebase, and without Firebase. ##### Expo without Firebase[​](#expo-without-firebase "Direct link to Expo without Firebase") If you're *not* using Firebase, provide the `iosUrlScheme` option to the config plugin. To obtain `iosUrlScheme`, follow [these instructions](/docs/setting-up/get-config-file.md?firebase-or-not=cloud-console#ios). app.json | js ```json { "expo": { "plugins": [ [ "@react-native-google-signin/google-signin", { "iosUrlScheme": "com.googleusercontent.apps._some_id_here_" } ] ] } } ``` ##### Expo and Firebase Authentication[​](#expo-and-firebase-authentication "Direct link to Expo and Firebase Authentication") If you are using Firebase Authentication, follow [these instructions](/docs/setting-up/get-config-file.md?firebase-or-not=firebase#step-2) to get `google-services.json` file for Android and [these instructions](/docs/setting-up/get-config-file.md?firebase-or-not=firebase#ios)) to get `GoogleService-Info.plist` for iOS. Place them into your project and specify the paths to the files: app.json | js ```json { "expo": { "plugins": ["@react-native-google-signin/google-signin"], "android": { "googleServicesFile": "./google-services.json" }, "ios": { "googleServicesFile": "./GoogleService-Info.plist" } } } ``` #### Build the native app[​](#build-the-native-app "Direct link to Build the native app") Run the following to generate the native project directories. ```sh npx expo prebuild --clean ``` Rebuild your app and read the [config guide](/docs/setting-up/get-config-file.md)! ```sh npx expo run:android && npx expo run:ios ``` --- ### Collecting configuration information Before getting your hands dirty with code, some configuration needs to be taken care of. Configuration information collected in this guide is used in later steps of the setup and in the `configure()` call: [1](/docs/one-tap.md#configure) or [2](/docs/original.md#configure). You **do not** need to use Firebase to configure Google Sign In. #### Android[​](#android "Direct link to Android") Follow the two steps below to set up Google Sign In for your Android app. warning In case you encounter any of the following issues, revisit this guide - it means the steps below weren't fully completed. * if you ever get the infamous `DEVELOPER_ERROR` error * if you can sign in with debug APK and not in release (or vice versa) ##### Step 1: Collect SHA-1 (not SHA-256) certificate fingerprints[​](#step-1-collect-sha-1-not-sha-256-certificate-fingerprints "Direct link to Step 1: Collect SHA-1 (not SHA-256) certificate fingerprints") Your Android app probably uses multiple signing configurations. For example, an app might be signed differently when building `debug` and `release` APKs locally or when building on [Expo EAS](https://docs.expo.dev/app-signing/managed-credentials/#inspecting-credentials-configuration). Then there's the [Play App Signing](https://support.google.com/googleplay/android-developer/answer/9842756?hl=en) for store deployments — Google Play Store may *re-sign* your app using one of its own signing configurations. important If your app is not yet in the Play Store, focus only on the development APK and its SHA-1 certificate fingerprint. You can come back to this guide later when you upload your app to the Play Store. However, be advised that in the end, you need to get the SHA-1 certificate fingerprints for *all* signing configurations and then use *all* of those SHA-1 fingerprints in [Step 2](#step-2) below. ###### Collect SHA-1 certificate fingerprints from:[​](#collect-sha-1-certificate-fingerprints-from "Direct link to Collect SHA-1 certificate fingerprints from:") * ✅ Any APK or device * Google Play Store (when downloading from it) * EAS Build * Local build Use the [Configuration Doctor](/docs/config-doctor.md). This is the **only universal option** — it works regardless of how the APK was built or where it came from. The other tabs cover specific scenarios. 1. Get a device / emulator with the app installed, or get the APK (build it locally or in cloud, download from the Play Console / Play Store...) 2. Run the tool and follow its instructions: ```bash npx @react-native-google-signin/config-doctor ``` Check if "Google Play App Signing" is enabled for your app [in the console](https://play.google.com/console/). If it is enabled, you need to take the following steps: 1. In Google Play Console, navigate to: \ -> Release section (in the left sidebar) -> Setup -> App Signing. 2. Under the "App signing key certificate", take note of `SHA-1 certificate fingerprint`(s). Play Store sometimes has more than one "App signing key certificate"! If you use [Expo EAS](https://expo.dev/eas), run `eas credentials` to obtain the Keystore information, which includes the SHA-1 fingerprint. See [EAS credentials docs](https://docs.expo.dev/app-signing/managed-credentials/#inspecting-credentials-configuration) to learn more. 1. From your project root, `cd android && ./gradlew signingReport`. 2. Scroll to the top of output, see the fingerprints. Debug fingerprint is used for locally-built debug APK, release fingerprint is used for release APK.

##### Step 2: Add SHA-1 fingerprints to Firebase or Google Cloud Console[​](#step-2 "Direct link to Step 2: Add SHA-1 fingerprints to Firebase or Google Cloud Console") For *each* of the SHA-1 fingerprints obtained in the previous step, follow the instructions below. * When using Firebase * When not using Firebase 1. Sign in to [Firebase Console](https://console.firebase.google.com/) and open your project. 2. Ensure that in the "Authentication" menu, "Google" is enabled as "Sign-in method". 3. Click the settings icon and go to "Project settings". 4. Scroll down to "Your apps" section, and select the app. 5. Click "Add fingerprint". 6. Check that "Package name" is correct. 7. Download the `google-services.json` file. ![Firebase, add Android keystore\'s SHA-1 to your project](/assets/images/android-fingerprint-firebase-5381019c8870df86888cdc8bb082d603.png) *For each* of the SHA-1 fingerprints you obtained, create an OAuth Client ID of type Android in [Google Cloud Console](https://console.cloud.google.com/apis/credentials?project=_) - see the screenshot below. Alternatively, use [this wizard](https://console.developers.google.com/henhouse/?pb=%5B%22hh-0%22%2Cnull%2Cnull%2Cnull%2C%22https%3A%2F%2Fdevelopers.google.com%22%2Cnull%2Cnull%2Cnull%2C%22Configure%20a%20project%20for%20Google%20Sign-In%22%2C1%2Cnull%2Cnull%2C0%2C1%2Cnull%2Cnull%2Cnull%2Cnull%2C0%2Cnull%2Cnull%2C0%2Cnull%2Cnull%2Cnull%2Cnull%2Cnull%2Cnull%2C0%2Cnull%2Cnull%2Cnull%2C0%5D). You will *NOT* need the created IDs later - the only goal here is for them to be created in the Google Cloud Console. ![Google Cloud Console - creating Android OAuth ID](/assets/images/android-client-id-2a2f8705a27c0cd9f2ed70529d8f29f4.png) *** #### iOS[​](#ios "Direct link to iOS") Read below on how to set up Google Sign In for your iOS app. * When using Firebase * When not using Firebase 1. Sign in to [Firebase Console](https://console.firebase.google.com/) and open your project. 2. Ensure that in the "Authentication" menu, "Google" is enabled as "Sign-in method". 3. Click the settings icon and go to "Project settings". 4. Scroll down to "Your apps" section, and select the app. 5. Check that "Bundle ID" is correct. 6. Download the `GoogleService-Info.plist` file. Remember that *all* created client IDs can be found in the [Google Cloud Console](https://console.cloud.google.com/apis/credentials?project=_). Obtain the "iOS OAuth Client ID" *and* "iOS URL scheme" (also known as `reversed client id`): Create an OAuth Client ID of type iOS in [Google Cloud Console](https://console.cloud.google.com/apis/credentials?project=_) as seen in the screenshot below. Alternatively, use [this wizard](https://console.developers.google.com/henhouse/?pb=%5B%22hh-0%22%2Cnull%2Cnull%2Cnull%2C%22https%3A%2F%2Fdevelopers.google.com%22%2Cnull%2Cnull%2Cnull%2C%22Configure%20a%20project%20for%20Google%20Sign-In%22%2C1%2Cnull%2Cnull%2C0%2C1%2Cnull%2Cnull%2Cnull%2Cnull%2C0%2Cnull%2Cnull%2C0%2Cnull%2Cnull%2Cnull%2Cnull%2Cnull%2Cnull%2C0%2Cnull%2Cnull%2Cnull%2C0%5D). You will need the iOS Client ID and iOS URL scheme later. ![Google Cloud Console - creating iOS OAuth ID](/assets/images/ios-client-id-0235e70ba063cac062966a2ce5847ed0.png) *** #### Web Client ID[​](#web-client-id "Direct link to Web Client ID") To get a Web Client ID (for the `configure()` call), go to [Google Cloud Console](https://console.cloud.google.com/apis/credentials?project=_) and find an existing one (it may have been already created by Firebase) or create a new OAuth Client ID of type **Web**. *** #### Summary[​](#summary "Direct link to Summary") At the end of this guide, regardless of whether you use Firebase, when you visit [Google Cloud Console](https://console.cloud.google.com/apis/credentials?project=_), you should have in the "OAuth 2.0 Client IDs" section: * Android OAuth Client ID(s) with SHA-1 fingerprints * iOS OAuth Client ID(s) with iOS URL scheme * Web Client ID --- ### iOS setup guide warning If you use Expo, follow [this guide](/docs/setting-up/expo.md) instead. This guide applies to vanilla React Native apps only. ##### Link the native module[​](#link-the-native-module "Direct link to Link the native module") * run `pod install` in the `ios/` directory to install the module ##### Google project configuration[​](#google-project-configuration "Direct link to Google project configuration") * Follow [this](/docs/setting-up/get-config-file.md) guide to get the configuration information which you need for the next steps. ##### Firebase Authentication[​](#firebase-authentication "Direct link to Firebase Authentication") If you're using Firebase Authentication, download the `GoogleService-Info.plist` file and place it into your Xcode project. ##### Xcode configuration[​](#xcode-configuration "Direct link to Xcode configuration") * Configure URL types in the `Info` panel (see screenshot) * add your "iOS URL scheme" (also known as `reversed client id`), which can be found in [Google Cloud Console](https://console.cloud.google.com/apis/credentials?project=_) under your iOS client ID. * If you need to support Mac Catalyst, you need to enable the Keychain Sharing capability on each build target. No keychain groups need to be added. ![link config](/assets/images/urlTypes-2096dbcdf48dfe2cb07c1e98f33d423f.png) #### Rebuild the native project[​](#rebuild-the-native-project "Direct link to Rebuild the native project") Do not forget to rebuild the native app after the setup is done. ##### Optional: modify your app to respond to the URL scheme[​](#optional-modify-your-app-to-respond-to-the-url-scheme "Direct link to Optional: modify your app to respond to the URL scheme") This is only required if you have multiple listeners for `openURL` - for instance if you have both Google and Facebook OAuth. Because only one `openURL` method can be defined, if you have multiple listeners for `openURL`, you must combine them into a single function as shown below: ###### For AppDelegate written in Swift[​](#for-appdelegate-written-in-swift "Direct link to For AppDelegate written in Swift") If your AppDelegate a Swift file (the default in React Native 0.77.0 or higher), you'll need to: 1. Add the following import to your project's [bridging header](https://developer.apple.com/documentation/swift/importing-objective-c-into-swift#Import-Code-Within-an-App-Target) file (usually `ios/YourProject-Bridging-Header.h`): ```objc // … // ⬇️ Add this import #import ``` 2. Modify your `AppDelegate.swift` file: ```swift // … @main class AppDelegate: RCTAppDelegate { // … // ⬇️ Add this method override func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool { // Add any other URL handlers you're using (e.g. Facebook SDK) return ApplicationDelegate.shared.application(app, open: url, options: options) || GIDSignIn.sharedInstance.handle(url) } } ``` ###### For AppDelegate written in Objective-C[​](#for-appdelegate-written-in-objective-c "Direct link to For AppDelegate written in Objective-C") For AppDelegate written in Objective-C (the default prior to React Native 0.77), modify your `AppDelegate.m` file: ```objc #import "AppDelegate.h" #import // ⬅️ add the header import // … @implementation AppDelegate // … // ⬇️ Add this method before file @end - (BOOL)application:(UIApplication *)application openURL:(nonnull NSURL *)url options:(nonnull NSDictionary *)options { // Add any other URL handlers you're using (e.g. Facebook SDK) return [[FBSDKApplicationDelegate sharedInstance] application:application openURL:url options:options] || [GIDSignIn.sharedInstance handleURL:url]; } @end ``` --- ### Web setup guide The web implementation doesn't depend on React Native (or React Native Web). That means you can use it even with regular web apps created with NextJS, Vite and etc. tip The functionality covered in this page is available in the licensed version. [You can get a license here](https://universal-sign-in.com/#pricing) ⭐️. On the web, you need to load the Google Client Library and make it available in the browser **before** calling any of the APIs exposed by this package. There are different ways to load the client script. Some of them are: * Next.js * Simple html * useEffect ```tsx import Script from 'next/script';