Authorisation and app state

Hi,

My app requires occasional user input over a long duration, so users typically want to log in and then have the app running in the background, popping into it occasionally to interact.

The issue is that they need to log in every time, and start the user journey again.

Is there any solution to preserve the app state when users navigate away from the app and not force them to log in every time?

Oli

Hi,

It depends a bit on what kind of authorization you have, but the basic logic would be the following:

  1. User logs in the first time
  2. The token (or whatever is used to validate the authenticaiton) from the login is saved into a client side database
  3. In the global canvas in App launch, you check if there are any records in the client side database
    a) If there are, get the token from the database, and log in using it. The user won’t have to log in manually
    b) If there isn’t, the login isn’t valid, and the user should log in.