Get facebook user if only logged in facebook php sdk

后端 未结 2 1962
[愿得一人]
[愿得一人] 2021-01-27 14:43

I want to get current loggedin facebook user in php sdk. Here is what i have tried:

$facebook = new \\Facebook(array(
        \'appId\' => \'XXXXXXXXXXX\',
           


        
2条回答
  •  被撕碎了的回忆
    2021-01-27 15:31

    I get the loginUrl even though I am logged in facebook.

    Of course you do – being logged in to facebook.com is something completely different than being logged in to your app.

    Only when i load $loginUrl in the browser, I am able to get facebook user.

    That’s because after that the user is logged in to your application.

    How do I get the current user at first load of this page?

    Only possible for users who have connected to your app already at some point before, by using the JavaScript SDK.

提交回复
热议问题