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}`);
}
}
Also in JavaScript:
- js create element
- javascript on url anchor change event
- javascript how to pass an action back in a function
- javascript regex match character from a set of characters
- redirect to website javascript
- javascript on submit
- how to submit a form in js
- retour a la ligne <p> react
- express messages
- table like another component in react native
- object json parse javascript
- iseet jquery
- express proxy
- insanceof
- angular new component
- python get json content from file
- react href
- js get file name from path
- capacitor.ionicframework.com to apk
- mongoose generate objectid
- how to write and read a text file in jdiscord.js
- mongoose geojson
- prevent double tap in react native
- jest expect error to be thrown