Response-native-fbsdk - how to get user profile?

onLoginFinished result just tells me the permissions granted. From repo it is not clear how to get the user profile. It seems that action-native-fbsdkcore should wrap FBSDKProfile.h, but can't see where it does it.

var FBSDKLogin = require('react-native-fbsdklogin'); var { FBSDKLoginButton, } = FBSDKLogin; var Login = React.createClass({ render: function() { return ( <View> <FBSDKLoginButton onLoginFinished={(error, result) => { if (error) { alert('Error logging in.'); } else { if (result.isCanceled) { alert('Login cancelled.'); } else { alert('Logged in.'); } } }} onLogoutFinished={() => alert('Logged out.')} readPermissions={[]} publishPermissions={['publish_actions']}/> </View> ); } }); 
+6
source share
2 answers

There is an easier way to do this. Instead of manually requesting a schedule, the "react-native-fbsdkcore" package to retrieve data associated with a registered user (if any)

var

  FBSDKCore = require('react-native-fbsdkcore'); var { FBSDKAccessToken, } = FBSDKCore; FBSDKAccessToken.getCurrentAccessToken((token) => { // token will be null if no user is logged in, // or will contain the data associated with the logged in user }); 

Cphackm's address is that this is problem number 2

+4
source

You have learned that you can enter a user profile using the Graph API.

 // Create a graph request asking for user profile var fetchProfileRequest = new FBSDKGraphRequest((error, result) => { if (error) { alert('Error making request.'); } else { // Data from request is in result } }, '/me'); // Start the graph request. fetchProfileRequest.start(); 
+3
source

All Articles