because when I use the function getUser () do not get the correct id? receipt is the id of the person logged on to work earlier and I have to reload the page.
how to make without loading the page 2 times I return the correct id?
because when I use the function getUser () do not get the correct id?
Share
Facebook::getUser()(if you use original PHP-SDK) retrieves the details of user from:* URL arguments
* Cookies set by Facebook JS-SDK or PHP-SDK
* Application session
So unless active session (not Facebook session, but one for your application) present and contain all the details required to identify your user there is no way to know his Facebook’s user
id.If you not able to get user
idby callinggetUserit means non of that data exists at the moment, and you will need to authenticate user:Facebook:getLoginUrl()status:truewas passed to FB.init)FB.getLoginStatus(JS-SDK) manuallyTo be albe to retrieve user’s details before loading the same twice you have two options:
Facebook:getLoginUrl()(well this will load your page twice but the on the first time only redirect will be triggered), authorization flow will just drive user back to your application with all details required for his identification.