You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -206,20 +206,112 @@ with the new authentication state of the user.
206
206
207
207
## Google
208
208
209
-
The [`google-signin`](https://github.com/react-native-google-signin/google-signin) library provides a wrapper around the official Google login library,
210
-
allowing you to create a credential and sign-in to Firebase.
209
+
Firebase does not ship a Google sign-in UI. You install a community library to obtain a Google **ID token**, then pass it to `GoogleAuthProvider.credential()` and `signInWithCredential()`.
211
210
212
211
Ensure the "Google" sign-in provider is enabled on the [Firebase Console](https://console.firebase.google.com/project/_/authentication/providers).
213
212
214
-
### Configure an Expo project
213
+
On **Android**, Google recommends [Credential Manager](https://developer.android.com/identity/sign-in/credential-manager-siwg-implementation) for Sign in with Google. Two maintained React Native libraries can provide that flow:
215
214
216
-
For Expo projects, follow [the setup instructions for Expo](https://react-native-google-signin.github.io/docs/category/setting-up) from `react-native-google-signin`.
|[`react-native-nitro-google-signin`](https://www.npmjs.com/package/react-native-nitro-google-signin)| Yes | Free (MIT) | Universal / One Tap-style API via [Nitro Modules](https://nitro.margelo.com); requires `react-native-nitro-modules`|
218
+
|[`@react-native-google-signin/google-signin`](https://github.com/react-native-google-signin/google-signin)| Yes with [Universal Sign-In](https://react-native-google-signin.github.io/docs/install); **no** on the free public `GoogleSignin` API | Paid for Credential Manager; free for legacy Android SDK | Universal Sign-In uses `GoogleOneTapSignIn`; the free public build is documented in the section below |
217
219
218
-
### Configure a React-Native (non-Expo) project
220
+
The sections below show Firebase integration for each approach. For native setup (OAuth clients, SHA-1, Expo config plugins), follow that library's documentation.
221
+
222
+
### react-native-nitro-google-signin
223
+
224
+
[`react-native-nitro-google-signin`](https://www.npmjs.com/package/react-native-nitro-google-signin) is a free, MIT-licensed option that uses **Credential Manager** on Android and the Google Sign-In SDK on iOS. It is a good fit when you want modern Android sign-in without a paid Universal Sign-In license from `@react-native-google-signin/google-signin`.
Then follow the [installation](https://react-native-nitro-google-signin.github.io/docs/getting-started/installation) and [Google Cloud setup](https://react-native-nitro-google-signin.github.io/docs/setup/google-cloud) guides. For Expo, use a [development build](https://docs.expo.dev/develop/development-builds/introduction/) and the [Expo config plugin](https://react-native-nitro-google-signin.github.io/docs/setup/expo) — it does not run in Expo Go.
233
+
234
+
#### Using Google Sign-In with Firebase
235
+
236
+
Configure once (with Firebase config files present, `webClientId: 'autoDetect'` reads the Web client ID from `google-services.json` / `GoogleService-Info.plist`):
Upon successful sign-in, any [`onAuthStateChanged`](/auth/usage#listening-to-authentication-state) listeners will trigger with the new authentication state.
294
+
295
+
If you test on an Android emulator, use an image with **Google APIs** or **Google Play** system images.
296
+
297
+
Full API details: [react-native-nitro-google-signin documentation](https://react-native-nitro-google-signin.github.io/).
298
+
299
+
### @react-native-google-signin/google-signin
300
+
301
+
The [`@react-native-google-signin/google-signin`](https://github.com/react-native-google-signin/google-signin) package is widely used and offers two tiers:
302
+
303
+
-**Universal Sign-In** ([paid](https://universal-sign-in.com/#pricing)): Cross-platform One Tap-style API (`GoogleOneTapSignIn`) with **Credential Manager** on Android. Licensed builds are installed from the package maintainer's registry — see [their installation guide](https://react-native-google-signin.github.io/docs/install).
304
+
-**Public (free) version**: `GoogleSignin` API for Android and iOS using the **legacy** Android Google Sign-In SDK. Google has deprecated that stack; it does not use Credential Manager. The examples below use this free API.
305
+
306
+
#### Configure an Expo project
307
+
308
+
For Expo projects, follow [the setup instructions for Expo](https://react-native-google-signin.github.io/docs/category/setting-up) from `@react-native-google-signin/google-signin`.
309
+
310
+
#### Configure a React-Native (non-Expo) project
219
311
220
312
For bare React-Native projects, most configuration is already setup when using Google Sign-In with React-Native-Firebase's configuration, however you need to ensure your machines SHA1 key has been configured for use with Android. You can see how to generate the key on the [Getting Started](/) documentation.
221
313
222
-
### Using Google Sign-In
314
+
####Using Google Sign-In
223
315
224
316
Before triggering a sign-in request, you must initialize the Google SDK with any required scopes and the
225
317
`webClientId`, which can be found in the `android/app/google-services.json` file as the `client/oauth_client/client_id` property (the id ends with `.apps.googleusercontent.com`). Make sure to pick the `client_id` with `client_type: 3`
@@ -282,6 +374,8 @@ with the new authentication state of the user.
282
374
283
375
If you are testing this feature on an android emulator ensure that the emulate is either the Google APIs or Google Play flavor.
284
376
377
+
> If you need Credential Manager on Android without a paid license, use [`react-native-nitro-google-signin`](#react-native-nitro-google-signin) instead of upgrading to Universal Sign-In.
378
+
285
379
## Microsoft
286
380
287
381
Per the [documentation](https://firebase.google.com/docs/auth/android/microsoft-oauth#expandable-1), we cannot handle the Sign-In flow manually, by getting the access token from a library such as `react-native-app-auth`, and then calling `signInWithCredential`.
@@ -406,22 +500,48 @@ To achieve this, you should replace sign-in method in any of the supported socia
406
500
407
501
This code demonstrates linking a Google provider to an account that is already signed in using Firebase authentication.
408
502
503
+
With [`react-native-nitro-google-signin`](https://www.npmjs.com/package/react-native-nitro-google-signin):
Copy file name to clipboardExpand all lines: docs/auth/usage/index.mdx
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -185,7 +185,7 @@ signOut(getAuth()).then(() => console.log('User signed out!'));
185
185
Once successfully signed out, any [`onAuthStateChanged`](/auth/usage#listening-to-authentication-state) listeners will trigger an event
186
186
with the `user` parameter being a `null` value.
187
187
188
-
Additionally, using `GoogleSignin.revokeAccess()` forgets the user. This means that the next time someone signs in, they will see the account selection popup. If you don't use this function, the last account will be automatically used without showing the account selection popup.
188
+
Additionally, calling `revokeAccess()`on your Google sign-in library forgets the user on the device (for example `GoogleOneTapSignIn.revokeAccess()` from [`react-native-nitro-google-signin`](https://www.npmjs.com/package/react-native-nitro-google-signin), or `GoogleSignin.revokeAccess()` from `@react-native-google-signin/google-signin`). The next sign-in will show the account picker again. Without it, the last account may be reused automatically.
0 commit comments