Hi,
I’m new to ionic. From last 2/3 weeks, I’m working on ionic to build a mobile app for our web application & currently in confusion at one step. Need some suggestion regarding the best way to solve this.
Our web application is built upon PHP & we are not using any kind of REST architecture in it. Since now, we are moving to the mobile app we are trying to refactor our codebase. So that, one base code will handle all both(mobile app/web app) kind of request.
In mobile app side, I’m using OAUTH(http://bshaffer.github.io/oauth2-server-php-docs/). It’s working fine. I can able to login/logout. But, I can’t able to manage my PHP SESSION data.
In the web application, I know after login PHP send a session id which get stored in browser cookie & in all subsequent HTTP call it gets attached by browser. But, in my mobile app I’m not getting that SESSION ID after login. So, I thought maybe this is the reason for which my mobile app is not getting the user’s SESSION data.
To resolve this, what I’ve done now…
After getting, authorization token & refresh token from OAUTH server, I include current PHP SESSION ID also in the data set & return back to the mobile app. Then, in all subsequent Http call I send that SESSION ID value to server side & by using the following code, I retrieve the user’s SESSION data.
session_id($_POST['session_id']);
session_start();
$UserData = $_SESSION['User'];
It’s working now. But, I really don’t know whether it’s a right way to do such things or not & mostly I’m concern with security issue associated with this. Can anyone guide me with this?
Regards