NativeFirebaseAuth
newAuth class for React Native/Expo using credential-based sign-in flows.
Google Sign-In
Requires @react-native-google-signin/google-signin. You obtain an idToken from the native SDK and pass it to Refirebase.
Google Sign-In
// 1. Configure Google Sign-In (once, e.g. in app init)
import { GoogleSignin } from '@react-native-google-signin/google-signin';
GoogleSignin.configure({ webClientId: 'YOUR_WEB_CLIENT_ID' });
// 2. Sign in
const { idToken } = await GoogleSignin.signIn();
const { data, error } = await auth.handleGoogleSignIn({ idToken });
if (error) {
console.error(error.code, error.message);
}Facebook Login
Requires react-native-fbsdk-next or similar. Pass the accessToken from Facebook's Login SDK.
Facebook Login
import { LoginManager, AccessToken } from 'react-native-fbsdk-next';
await LoginManager.logInWithPermissions(['public_profile', 'email']);
const token = await AccessToken.getCurrentAccessToken();
const { data, error } = await auth.handleFacebookSignIn({
accessToken: token.accessToken,
});ℹ
All methods return
{ data, error }. The errorincludes a user-friendly message and Firebase code.Methods
| Param | Type | Description |
|---|---|---|
handleGoogleSignIn | ({ idToken, accessToken? }) => Promise | Sign in with a Google ID token from the native SDK. |
handleFacebookSignIn | ({ accessToken }) => Promise | Sign in with a Facebook access token from the native SDK. |
handleCredentialSignIn | (credential) => Promise | Sign in with any Firebase AuthCredential (escape hatch). |
handleSignOut | () => Promise | Sign out the current user. |
onAuthStateChanged | (callback) => unsubscribe | Listen for auth state changes. |
native | Auth | Underlying Firebase Auth instance (escape hatch). |