Is it a good practice or am i missing something? I wan't to store user access and refresh token returned from a Web API in application-settings or do we have password vault equivalent in nativescript or do we use sql lite My requirement is that my tokens should not be allowed to access by other apps installed on device. Thanks for the help in advance Regards
If you just want to store a simple string, only accessible by the app itself (and no other app), using the Application Settings is the way to go.
var appSettings = require('application-settings');
// Trying to get a string which is not set yet
var token = appSettings.getString('token', 'defaultValue');
console.log(token); // defaultValue
// Setting the string
appSettings.setString('token', 'abc123');
// Getting the string
token = appSettings.getString('token', 'defaultValue');
console.log(token); // abc123
There's no vault (yet?).
If you want to store some more database-like data, there's a sqlite module available, however, for only storing a simple string or two, this would be way overkill and I'd go for the application-settings way described above.
https://www.npmjs.com/package/nativescript-sqlite
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With