I\'m trying to make a function in my controller to post an album to Facebook. Every time the function is accessed, I\'m redirected to REDIRECT_URI, as if the $userid=0, eve
By default the Facebook class uses PHP sessions to store the authentication state of the user. There are four session variables that may be used:
fb_{appid}_user_id
: Facebook user IDfb_{appid}_code
: authorization code that needs to be exchanged for an access tokenfb_{appid}_access_token
: access token that can be used to make API callsfb_{appid}_state
: CSRF tokenCheck that your PHP sessions are configured and working correctly.
You cannot output any text before starting the session (done automatically if needed when instantiating the Facebook
object). You might want to try putting this as the very first line of your function:
if (!session_id()) { session_start(); }