title: Securely store access token in Cordova
body: <p><strong>Edit:</strong> <em>see my <a href="https://stackoverflow.com/a/36480620/999516">answer</a> for the solution</em></p>
  
  <p>Currently working on a Hybrid App with <a href="http://ionicframework.com/" rel="nofollow noreferrer">Ionic</a> where there is a requirement to store an authentication Token in order to keep the user logged in, and also guarantee that this data cannot be accessed outside  the App context.</p>
  
  <p>There is of course plenty of solutions for this task, each one with different pros-and-cons so it's confusing (for me) to locate the one technology that fits.</p>
  
  <p>I've been looking at <a href="https://github.com/ocombe/angular-localForage" rel="nofollow noreferrer">angular-localForage</a> and other candidates:</p>
  
  <hr>
  
  <h2>LocalStorage</h2>
  
  <ul>
  <li>Obvious choice for small data.</li>
  <li>Data gets wiped in <code>iOS</code> when the system is low on memory.</li>
  </ul>
  
  <h2>IndexedDB</h2>
  
  <ul>
  <li>Buggy support in <code>iOS</code> (<a href="http://caniuse.com/#feat=indexeddb" rel="nofollow noreferrer">IndexedDB support</a>)</li>
  </ul>
  
  <h2>WebSQL (SQLite)</h2>
  
  <ul>
  <li>Apparently a good option for small data and decent support (<a href="http://caniuse.com/#feat=sql-storage" rel="nofollow noreferrer">WebSQL suppport</a>) but it's deprecated.</li>
  </ul>
  
  <h2>SQLite</h2>
  
  <ul>
  <li>There are related issues with <code>Cordova</code> in <code>iOS</code>.</li>
  </ul>
  
  <h2>LokiJS</h2>
  
  <ul>
  <li>Looks like an overkill for this scenario but is definitely a strong candidate. Is the any security concerns I should be aware of (as I read it  locally persist data to <code>JSON</code> files)?</li>
  </ul>
  
  <h1>PouchDB + SQLite</h1>
  
  <ul>
  <li>Well, it's a JS client to work with CouchDB or Couchbase databases wich can also work with SQLite but again I only need to store a Token..</li>
  </ul>
  
  <hr>
  
  <p>So apparently the best option for Android/iOS cross-compatibility should ironically be WebSQL, but is no longer being developed and I have to guarantee long-term support.</p>
  
  <p>So my question is: are there any other options I'm missing to securely store an access Token? If don't, wich of the above ones should be the best choice for this task?</p>