简体   繁体   中英

getUser() returning 0 when using php SDK. It was working a few days ago and the code has not changed

I'm using the php SDK getUser() function to receive a facebook user's ID, but now it's returning 0 when a few days ago it was returning the correct ID. Has something changed? Any reason why it would stop working all of a sudden?

Of course you need an access token for getting the user id. Just authorize your user (again) with "getLoginUrl": https://developers.facebook.com/docs/reference/php/facebook-getLoginUrl/

Be aware that a user access token is valid for 2 hours only (or 60 days if you extend it with "setExtendedAccessToken").

If it doesn´t work even after authorizing the user with getLoginUrl, keep in mind that you have to call that url again to refresh the access token. Also, make sure your PHP SDK is up to date and the settings are correct (App-ID and App-Secret).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM