'expo Facebook login access to birthday email
how can I access to the email and birthday in expo facebook login ?
I only get the name and ID...
async function logIn() {
try {
await Facebook.initializeAsync({
appId: 'ID',
});
const { type, token, expirationDate, permissions, declinedPermissions } =
await Facebook.logInWithReadPermissionsAsync({
permissions: ['public_profile', 'email'],
});
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}`);
const data = await response.json()
console.log(data);
} else {
// type === 'cancel'
}
} catch ({ message }) {
alert(`Facebook Login Error: ${message}`);
}
}
Solution 1:[1]
Here is a Code sample
const response = await fetch(
`https://graph.facebook.com/me?access_token=${token}&fields=id,name,email,about,picture`
);
Solution 2:[2]
The only way to get the users e-mail address is to request extended permissions on the email field. The user must allow you to see this and you cannot get the e-mail addresses of the user's friends.
http://developers.facebook.com/docs/authentication/permissions
You can do this if you are using Facebook connect by passing scope=email in the get string of your call to the Auth Dialog.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | SirMissAlot |
| Solution 2 | Charfeddine Mohamed Ali |
