Welcome Guest, Not a member yet? Register   Sign In
Setting sessions with an Ionic Framework App
#1

Hi,

    I have a website using CodeIgniter as a server-side framework mainly for managing user sessions.

    In the website, when logging in a user, session is stored and there is no problem.

    Now I'm developing a Ionic app using the same API than the website use.

    The problem is that the session is not stablished. I'm trying to figure out why but do not find anything.

    My set session function is:

Code:
private function setSession($id, $email) {
          $this->load->library('session');
          $this->session->sess_expiration         = 0;
          $this->session->sess_cookie_name        = 'ci_sessions';
          $this->session->sess_expire_on_close    = FALSE;
          $this->session->sess_encrypt_cookie     = FALSE;
          $this->session->sess_use_database       = TRUE;
          $this->session->sess_table_name         = 'ci_sessions';
          $this->session->sess_match_ip           = FALSE;
          $this->session->sess_match_useragent    = TRUE;
          $this->session->sess_time_to_update     = 86400;
          $this->session->set_userdata( array('user' => $id, 'hasSession' => true, 'id' => $id, 'email' => $email) );
      }
Each time I navigate in the website, I check user session invoking the following function:
Code:
public function isSessionActive() {
         $this->load->library('session');
         if ( $this->session->userdata('user') ) {
             return true;
         } else return false;
     }

In case the session variable 'user' exists, it indicates that there is a session active for the user. As I mentioned above, using this code, in the website it works fine, but when using it in an Ionic App, the function isSessionActive() always returns false.
What's happening? Any help?
Reply


Messages In This Thread
Setting sessions with an Ionic Framework App - by mavillar - 05-17-2016, 05:54 PM



Theme © iAndrew 2016 - Forum software by © MyBB