Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

login with facebook expo react native

async function logIn() {
  try {
    await Facebook.initializeAsync({
      appId: '<APP_ID>',
    });
    const { type, token, expirationDate, permissions, declinedPermissions } =
      await Facebook.logInWithReadPermissionsAsync({
        permissions: ['public_profile'],
      });
    if (type === '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

login with facebook expo react native

import * as Facebook from 'expo-facebook';
Comment

PREVIOUS NEXT
Code Example
Javascript :: variables con nombre dinamico javascript 
Javascript :: react 18 double render 
Javascript :: leaflet update marker icon 
Javascript :: update state in useState hook 
Javascript :: object literals and array literals in javascript 
Javascript :: dayjs dayofyear 
Javascript :: create window electron 
Javascript :: regex number 
Javascript :: binary sort js 
Javascript :: how to add multiple event listener in javascript 
Javascript :: nesting express routes 
Javascript :: how to decode jwt token client side 
Javascript :: jquery document ready deprecated 
Javascript :: sweetalert2 small icon 
Javascript :: javascript function return 
Javascript :: node query selector 
Javascript :: how to split an array javascript 
Javascript :: hot to start cypress 
Javascript :: inline styling javascript 
Javascript :: asynch action redux 
Javascript :: recaptcha v3 js 
Javascript :: rails json schema validation 
Javascript :: invalid json response body at 
Javascript :: linear search javascript 
Javascript :: get number right of the dot length javascript 
Javascript :: dot notation vs bracket notation 
Javascript :: apexcharts bar onclick index 
Javascript :: how to use settimeout in react 
Javascript :: javascript get object value dynamically 
Javascript :: vue3 header 
ADD CONTENT
Topic
Content
Source link
Name
3+3 =