Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
signInWithFacebook: async () => {
try {
const {
type,
token,
expires,
permissions,
declinedPermissions,
} = await Facebook.logInWithReadPermissionsAsync(
Constants.manifest.facebookAppId,
);
if (type === 'success') {
// create a new firebase credential with the token
const credential = FacebookAuthProvider.credential(token);
// login with credential
await firebase.auth().signInWithCredential(credential);
// Get the user's name using Facebook's Graph API
// const response = await fetch(`https://graph.facebook.com/me?access_token=${token}`);
} else {
// type === 'cancel'
}
} catch ({ message }) {
alert(message);
}
},
},