Skip to content

Instantly share code, notes, and snippets.

@irrationnelle
Created April 13, 2018 06:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save irrationnelle/9740557f5dcd36f0cc9875274289cb98 to your computer and use it in GitHub Desktop.
Save irrationnelle/9740557f5dcd36f0cc9875274289cb98 to your computer and use it in GitHub Desktop.
fblogin.js
async componentDidMount() {
const { type, token } = await Facebook.logInWithReadPermissionsAsync(
'2060058184212334',
{
permissions: ['public_profile', 'email'],
}
);
if (type === 'success') {
const response = await fetch(
`https://graph.facebook.com/me?access_token=${token}&fields=id,name,email,about,picture`
);
const responseJSON = JSON.stringify(await response.json());
console.log(responseJSON);
} else {
console.log('error');
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment