Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const facebookLogin = async (): Promise => {
setSigningInFacebook(true);
try {
await Facebook.initializeAsync(
Constants.manifest.facebookAppId,
undefined,
);
const result = await Facebook.logInWithReadPermissionsAsync({
permissions: ['email', 'public_profile'],
});
if (result.type === 'success') {
const { token, expires, permissions, declinedPermissions } = result;
const response = await fetch(
`https://graph.facebook.com/me?fields=
id,name,email,birthday,gender,first_name,last_name,picture
&access_token=${token}`,
);
// console.log('success', response);
onPress={async () => await Facebook.initializeAsync(appId)}
title="Initialize Facebook SDK"
onPress={async () => await Facebook.setAutoInitEnabledAsync(true)}
title="Set autoinit to true"
onPress={async () => await Facebook.setAutoInitEnabledAsync(false)}
title="Set autoinit to false"
loginWithFacebook = async () => {
return await this.facebookLogin(
Facebook.logInWithReadPermissionsAsync(FACEBOOK_APP_ID, {
permissions: ['public_profile', 'email']
})
);
};