How to enforce login state & token storage

Hi Guys,

I have just finished building my login for my new app, and basically after it logs in it receives an token which I am storing in a JSON file using the storage API.

Two things:

One: Is there a better/more secure method than just storing it in a JSON file…

Two: How do I enforce that if there is a token, when the user opens the app again it takes him straight past the login view into the Dashboard view.



I am doing a very similar thing in my app. Right now I am storing it using the storage API so I hope someone from the Fuse team chimes in on that point. To your second point, I just route past the login from the login.js when it is init. The userFunctions is another JS file that takes care of token/api/user functions.

function init(){
    //If a user token is present, skip the login
    if (userFunctions.readToken()){
        router.goto('sidebarPage', {}, 'pendingPayments', {});