Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

react native firebase login with facebook

  async function logIn() {
    try {
      await Facebook.initializeAsync({
        appId: "APP ID HERE",
      });
      const {
        type,
        token,
        expirationDate,
        permissions,
        declinedPermissions,
      } = await Facebook.logInWithReadPermissionsAsync({
        permissions: ["public_profile"],
      });
      if (type === "success") {
        alert(`HELLO`);
        console.log("SUCCESS");

        // Get the user's name using Facebook's Graph API
        const response = await fetch(
          `https://graph.facebook.com/me?access_token=${token}`
        );
        Alert.alert("Logged in!", `Hi ${(await response.json()).name}!`);
      } else {
        // type === 'cancel'
      }
    } catch ({ message }) {
      alert(`Facebook Login Error: ${message}`);
    }
  }
Comment

PREVIOUS NEXT
Code Example
Javascript :: Showing a custom toast function for react-toastify - Toast show 
Javascript :: react native layout 
Javascript :: No match found for location with path 
Javascript :: convert rgb to hex 
Javascript :: find the sum of an attribute in sequelize 
Javascript :: handling transaction in sequelize 
Javascript :: a full express function 
Javascript :: what is axios used for 
Javascript :: convert js to python online 
Javascript :: dropdown hide 
Javascript :: react-select-search useSelect hook 
Javascript :: random picture position in react 
Javascript :: mongoose max record 
Javascript :: how to do something once in javascript 
Javascript :: base64 in js 
Javascript :: display fetch response js 
Javascript :: clear input value with javascript 
Javascript :: js index to index 
Javascript :: nested arrays reactjs tables 
Javascript :: array.sort 
Javascript :: js select all 
Javascript :: what is closure 
Javascript :: history react router 
Javascript :: js insert 
Javascript :: js rename property 
Javascript :: how to select last element in a array 
Javascript :: loopback 
Javascript :: table like another component in react native 
Javascript :: How to compare two different date formats in javascript 
Javascript :: js detect end of array 
ADD CONTENT
Topic
Content
Source link
Name
4+7 =