title: Mobile App Development - HTML5 LocalStorage versus SessionStorage versus Cookies
body: <p>We are developing a mobile web application on the jQuery Mobile platform that requires a user to provide their username and password.</p>
  
  <p>Rather than asking the user to re-enter their details each time we want to only ask them once for their username and password and then prompt them to enter a pin.</p>
  
  <p>We will encrypt this pin and encrypt a user identifier string and save both either in LocalStorage or Cookie.</p>
  
  <p>When the user visits the application for a second time we will test if a user identifier can be found and if so prompt them to enter a pin.</p>
  
  <p>Once the pin is entered we will securely (SSL) pass the pin and the user identifier to be decrytped and validated on the server.</p>
  
  <p>I've read in a few places that we should use Cookies instead of LocalStorage (from a security point of view). Would you concur with this and can cookies be used across most smart-phones?</p>
  
  <p>We also need to ensure that the user is required to re-enter their pin each time they close the browser or browse to another page or exceed 30 minutes of inactivity.</p>
  
  <p>To manage this I was thinking of storing a value in SessionStorage as I have read that this is more secure than LocalStorage and expires when the browser is closed. Alternatively we could use Cookies again.</p>
  
  <p>Security is a key concern so I'd be intersted to hear any tips and/or alternative approaches you may have.</p>
  
  <p>Many thanks in advance... </p>