When a user arrives at my site, a session is started for them. There is a point where a child window is spawned using JavaScript on my sites home page.
This child window goes to Twitter site to authenticate the user and it gets redirected back to a script on my site which stores some variables in a SESSION.
I have found out that the PHP script in the child window isn't aware of the session and session_id that is set already and it therefore starts a new session which means the parent window (index.php) can not access those session variables.
I am baffled. What can I do?
Update
Here is my code, but its not my code that is the problem, its the implementation that I am having trouble with.
index.php
<?php session_start(); ?>
oauth.php //child window
<?php session_start();
$_SESSION['screen_name'] = $twitterInfo->screen_name;
$_SESSION['profile_image_url'] = $twitterInfo->profile_image_url;
?>
When child window closes and I use AJAX to check a screen_name like so, it returns a no match as the child window oauth.php is using a different session (id).
<?php session_start();
sleep(1);
if(isset($_SESSION['screen_name'])){
echo 'done';
exit;
}else{
echo session_id().$_SESSION['screen_name'];
exit;
}
?>