title: Access PHP Session in Ionic app
body: <p>I'm new to ionic. From last 2/3 weeks, I'm working on ionic to build a mobile app for our web application &amp; currently in confusion at one step. Need some suggestion regarding the best way to solve this.</p>
  
  <p>Our web application is built upon PHP &amp; 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. </p>
  
  <p>In mobile app side, I'm using OAUTH(<a href="http://bshaffer.github.io/oauth2-server-php-docs/" rel="nofollow">http://bshaffer.github.io/oauth2-server-php-docs/</a>). It's working fine. I can able to login/logout. But, I can't able to manage my PHP SESSION data. </p>
  
  <p>In the web application, I know after login PHP send a session id which get stored in browser cookie &amp; 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.</p>
  
  <p>To resolve this, what I've done now... 
  After getting, authorization token &amp; refresh token from OAUTH server, I include current PHP SESSION ID also in the data set &amp; return back to the mobile app. Then, in all subsequent Http call I send that SESSION ID value to server side &amp; by using the following code, I retrieve the user's SESSION data.</p>
  
  <pre><code>session_id($_POST['session_id']);
  session_start();
  $UserData = $_SESSION['User'];
  </code></pre>
  
  <p>It's working now. But, I really don't know whether it's a right way to do such things or not &amp; mostly I'm concern with security issue associated with this. Can anyone guide me with this?</p>
  
  <p>Regards</p>