26
loading...
This website collects cookies to deliver better user experience
com.<project-name>
. This package name could be pretty common and can give error when adding SHA1 key in firebase. So it would be good to rename package name to something unique by adding a namespace in between i.e. com.<company-name>.<project-name>
google-services.json
file and put it in android/app location. This file contains information about clientId etc.. Native firebase SDK uses this file to make authenticated request to firebase service./android/build.gradle
and add
dependencies {
// ... other dependencies
classpath 'com.google.gms:google-services:4.3.8'
// Add me --- /\
}
/android/app/build.gradle
and add
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services' // <- Add this line
import { GoogleSignin } from '@react-native-google-signin/google-signin';
GoogleSignin.configure({
webClientId: '',
});
client/oauth_client/client_id
nodeimport auth from '@react-native-firebase/auth';
import { GoogleSignin } from '@react-native-google-signin/google-signin';
async function onGoogleButtonPress() {
// Get the users ID token
const { idToken } = await GoogleSignin.signIn();
// Create a Google credential with the token
const googleCredential = auth.GoogleAuthProvider.credential(idToken);
// Sign-in the user with the credential
return auth().signInWithCredential(googleCredential);
}