Consider this controller method
public function authenticate_session($user, $access_token) {
$this->output->enable_profiler(TRUE);
$user = $this->user_model->find_users(array("email" => $user, "access_token" => $access_token), "email, last_activity, access_token");
if ($user) {
$this->load->library('session');
$this->session->set_flashdata('post_data', $this->input->post(NULL));
redirect("v1/transactions_controller/pay");
} else {
redirect("v1/sessions/unauthenticated");
}
}
And the pay method in the transactions controller
public function pay() {
$this->output->enable_profiler(TRUE);
$this->load->library('session');
var_dump($this->session->flashdata());
}
var_dump($this->session->flashdata());
gives me array(0) { }
I've checked everywhere I know to and everyone seems to be saying that flash_data in the session library is the best option for me. I need to pass those POST parameters from the initial request on to the transactions controller once the user has been authenticated. If I remove the redirect and simply do var_dump($this->session->flashdata());
I see what I expect (POST data from the previous request), but it's not passing after the redirect.
Using redirect("v1/transactions_controller/pay", "refresh");
doesn't seem to actually go to the new controller and instead refreshes in place on the authentication controller method, but I do get to see my flashdata. Am I doing something wrong? Should my server be configured a certain way for this to work properly?
I've added session_start() to my index.php, but it threw an error because it's already in the session library, which is loaded by both controllers that need it.
My session and cookie variables in config.php
$config['cookie_prefix'] = '';
$config['cookie_domain'] = 'localhost';
$config['cookie_path'] = '/';
$config['cookie_secure'] = FALSE;
$config['cookie_httponly'] = FALSE;
$config['sess_driver'] = 'files';
$config['sess_cookie_name'] = 'ci_session';
$config['sess_expiration'] = 7200;
$config['sess_save_path'] = NULL;
$config['sess_match_ip'] = FALSE;
$config['sess_time_to_update'] = 300;
$config['sess_regenerate_destroy'] = FALSE;