是否可以同时使用读取和发布权限?

时间:2019-03-27 23:22:28

标签: react-native-fbsdk

我想同时通过LoginManager以读取和发布权限登录。有可能吗?

我找到了与此类似的解决方案,但是它迫使用户两次打开窗口

有什么主意吗?

LoginManager
            .logInWithReadPermissions(['public_profile'])
            .then(
            function(result) {
                if (result.isCancelled) {
                    console.log("Login cancelled");
                } else {
                    console.log(
                        "Login success with permissions: " +
                        result.grantedPermissions.toString()
                    );

                    LoginManager
                        .logInWithPublishPermissions(['manage_pages'])
                        .then(
                            function(result) {
                                if (result.isCancelled) {
                                    console.log("Login cancelled");
                                } else {
                                    console.log(
                                        "Login success with permissions: " +
                                        result.grantedPermissions.toString()
                                    );

                                    AccessToken.getCurrentAccessToken().then((data) => {
                                        console.log(data.accessToken.toString())
                                    })
                                }
                            },
                            function(error) {
                                console.log("Login fail with error: " + error);
                            }
                        );
                }
            },
            function(error) {
                console.log("Login fail with error: " + error);
            }
        );

0 个答案:

没有答案