am using php backend controllers with Ionic 3 application. Ionic 3 login works perfect with back-end controller and creates session and I store user data in the session variable.
When I access another controller via Ionic 3 after login success,It get destroyed and it has no any user data in the session.
I need to keep session data until it destroy on logout,
but app works completely fine in android.
I am using ios simulator(ios 10.3) on Xcode 8.3.3
Here is my code.
userInfo={} as UserInfo;
this.http.post(this.baseUrl+'index.php/login/user_login', credentials, options).
map(res => res.json()).subscribe(
data => {
if(data['status']==true && data['data']['login']==true){
//Store user Info
this.userInfo.username=data['data']['user_details']['username'];
this.userInfo.user_type=data['data']['user_details']['user_type'];
this.userInfo.user_id=data['data']['user_details']['user_id'];
this.storage.set('user_info',this.userInfo).then(()=>{
this.gui_permission();
this.isLoggedIn=true;
this.loggedUser=this.user.username;
});
this.loading.dismiss();
this.storage.set('user',this.user.username).then(()=>{
this.isLoggedIn=true;
this.loggedUser=this.user.username;
});
this is how i check the session data in php
//Checking whether user logged or not
public function is_login(){
$details = $this->session->userdata('username');
$is_loged_in = $this->session->userdata('loged_in');
if(!$details || !$is_loged_in) {
redirect('login');
}
}