CodeIgniter - Is my custom session data being stripped by Facebook?

You can use var_dump() to output the session. Something like this var_dump($this->session) The set_userdata call looks ok. Are you sure $user_id is set.

Because the echo is surley executed but uid isn't set or set to empty string Try replacing the echo with echo ':test_'. $this->session->userdata('uid'). '_test: Other information helpful for answering What browser are you using?

Do you have an underscore in your domain name? Are you using CI sessions or some wrapper for native PHPsessions Is the value for uid also lost/not set when you comment out the redirect? Other suggestions: try redirect('/preferences/index/', 'refresh') instead of location I'm not familiar with facebook development but is preferences/index under your control?

If yes try removing (if present) $this->load->library(‘session’) and instead load it in autoload. Php try changing $config‘sess_match_ip’ to `FALSE try setting $config‘sess_encrypt_cookie’ to FALSE try replacing the use of CI-Session with CI Native session Is UID sensible information if not store it in a cookie. If it matters if it can be spoofed don't.

You can use var_dump() to output the session. Something like this var_dump($this->session); The set_userdata call looks ok. Are you sure $user_id is set.

Because the echo is surley executed but uid isn't set or set to empty string. Try replacing the echo with echo ':test_'. $this->session->userdata('uid').'_test:'; Other information helpful for answering What browser are you using?

Do you have an underscore _ in your domain name? Are you using CI sessions or some wrapper for native PHPsessions Is the value for uid also lost/not set when you comment out the redirect? Other suggestions: try redirect('/preferences/index/', 'refresh'); instead of location I'm not familiar with facebook development but is /preferences/index under your control?

If yes try removing (if present) $this->load->library(‘session’) and instead load it in autoload.php. Try changing $config‘sess_match_ip’ to `FALSE try setting $config‘sess_encrypt_cookie’ to FALSE try replacing the use of CI-Session with CI Native session Is UID sensible information if not store it in a cookie. If it matters if it can be spoofed don't.

So I've done that. When I access the page outside of Facebook, it shows the full expected array: array(6) { "session_id"=> string(32) "3ee0c3caea3bf41153ad03f3483c05e5" "ip_address"=> string(10) "10.19.32.6" "user_agent"=> string(50) "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en" "last_activity"=> string(10) "1256249601" "key"=> string(5) "value" "uid"=> string(8) "userid#" } BUT when I access the same page via Facebook, it only shows the 4 values that CI sets on its own (sessid, IP, usragent, and lastactivity). Anyone know if these are set differently?

Stored? – Alex Mcp Oct 22 '09 at 22:16 I'm using both Safari 4.03 and FF 3.5.3 on OS X. So I just set $user_id = 1234 to try that.It echos within the else when I comment the redirect, but doesn't come back from the session array.

:-/ – Alex Mcp Oct 22 '09 at 22:39 And I'm using the CI sessions from a stock download I also did the test surrounding the echo on the redirect page, and it comes out :test__test: – Alex Mcp Oct 22 '09 at 22:40 Are you using an iframe somewhere? Then maybe the data you set are treated as 3rd party cookies – jitter Oct 22 '09 at 22:59 The Facebook app isn't setup as an iFrame application. – Alex Mcp 10.199 at 2:04.

I didn't solve how to pass session variables from one page to another via Facebook. My solution was simply to call the Facebook API for the user's UID again on each page. Not great programming, but it works alright for me.

I'm working within Facebook, and have a login page, and once that's successful I want to pass around the UID of the current user, and I thought this would work well. So it totally skips over the middle echo containing the uid. Am I not setting this correctly?

Is there a way to dump all values of the session array to see what's getting through? Any help would be just great. I have run var_dump($this->session->userdata) on each the raw website and through Facebook.

On the website it exposes all set values in an array containing 5 values (session_id, IP, User_agent, last_activity, and uid). Within the Facebook chrome however, it only shows the 4 values set by CodeIgniter. I've heard cookies can only be 4k and that encryption could be a problem.

Could FB be filling up cookies with its own encrypted (read:larger) data? It dutifully returns :test_1234_test: within Facebook. So somewhere during the redirect it's losing this part of the array (but not the whole array).

Is it possibly just creating a new session on the redirect page? So that's why it only has the four "stock" variables? If this is the case, I'll need to research how it creates the sessions, and if Facebook clears cookies I suppose.

So I've turned to using a DB to store session information instead of cookies, thinking FB was either stripping them or colliding with them. So it creates one good record, with the user data, then immediately upon the redirect creates a new session without recognizing the prior one. Can someone explain where the CI framework checks to see if it has a prior session existing?

The user manual explains it as "magic" basically.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions