nathvarun / React-Native-Firebase-Tutorials

All Tutorial Files for Youtube Tutorial Series

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Project files for the react native firebase tutorial series on youtube.

Tutorial #3 Facebook-Login Complete Project Files.

  • Learn how to add Facebook Login to Your React Native + Firebase App.

Install Dependencies

npm install 

Configure App.js

// Initialize Firebase
const firebaseConfig = {
  // ADD YOUR FIREBASE CREDENTIALS
  apiKey: "",
  authDomain: "",
  databaseURL: "",
  projectId: "",
  storageBucket: "",
};

Add your Facebook App Id

  async loginWithFacebook() {

    //ENTER YOUR APP ID 
    const { type, token } = await Expo.Facebook.logInWithReadPermissionsAsync('<APP ID>', { permissions: ['public_profile'] })

    if (type == 'success') {

      const credential = firebase.auth.FacebookAuthProvider.credential(token)

      firebase.auth().signInWithCredential(credential).catch((error) => {
        console.log(error)
      })
    }
  }

That's all you need!

About

All Tutorial Files for Youtube Tutorial Series

License:MIT License


Languages

Language:JavaScript 100.0%