react-native-facebook-login icon indicating copy to clipboard operation
react-native-facebook-login copied to clipboard

use eact-native-facebook-login to request publish permissions

Open saeed2402 opened this issue 8 years ago • 2 comments

Hi all, Has anyone been able to request publish permission using this project successfully, after user logs in and read permissions are asked? I am requesting read permission at the user login using code below:

return (
      <FBLogin 
        ref={(fbLogin) => { this.fbLogin = fbLogin }}
        permissions={["email","public_profile","user_location","user_hometown","user_birthday","user_about_me","user_friends","user_likes","pages_show_list","user_education_history","user_work_history"]}
        loginBehavior={FBLoginManager.LoginBehaviors.Native}
        onLogin={function(data){          
            _this.props.onLogin(data.credentials.token, _this.props.navigator);
        }}
        onLogout={function(){
            _this.props.onLogout(_this.props.navigator);
        }}
        onError={function(data){                  
        }}
                 
      />
    );

And then in another file, I am trying to request publish permission like this:

var {FBLogin, FBLoginManager} = require('react-native-facebook-login');
...
FBLoginManager.loginWithPublishPermissions(["publish_actions"],function(error, data){
                if (!error) {
                    console.log("Login data: ", data);
                } else {
                    console.log("Error: ", error);
                }
                });

And this is the result: image

Please help if you know what needs to be done.

Cheers.

saeed2402 avatar Jan 19 '17 12:01 saeed2402

@saeed2402 There is no method for loginWithPublishPermission that this package exports. Currently the package wraps only the native logInWithReadPermissions.

charlle avatar Oct 19 '17 21:10 charlle

in v2.12 there is now LoginManager.logInWithPublishPermissions

husnaingoldev avatar Feb 20 '18 12:02 husnaingoldev