Created
April 13, 2018 06:36
-
-
Save irrationnelle/9740557f5dcd36f0cc9875274289cb98 to your computer and use it in GitHub Desktop.
fblogin.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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