How To Save The User As Logged In After Closing + Re-Opening The App?



When i close my app and re-open it it re-directs to the login screen again.

How Do I Save The User As Logged In After Closing + Re-Opening The App?


Hi @justincrabbe. These are places to use the global variable. You can store what you need there for verification and refer to them appropriately. They live through app closes.

Also making a verification api request to check that the token isn’t expired are ways to run a test that ensures your users will move forward successfully.


When you say ‘global variable’ is this different than a device variable (currently used for login tokens) and page variables?

Or is a “global variable” and device variable the same thing and will be saved even when the app closes / re opens?


Yes they are the same. I should’ve been more explicitly. Device variables are stored on device and live even after an app is hard closed.


What is the best practice here to ‘check’ if the device variable token is still valid?

Do we run an API call “on application launch” inside of Dropsource that uses an if / else statement to direct the user to “login” page if response contains ‘unauthorized’ and redirect the user to HOME SCREEN if the call is 200?

Never set this up before. Best practice appreciated!

UPDATE: Can’t set it up on “application launch” it appears:


Bump on this thread…


Couple ways, your backend can deliver an error code back anytime a request is submitted with an expired token and you can reauthorize based on the error code action with each call…

Or you can run a request and send the current token to the backend wherever you want in the app to test if a token is valid or not and handling the appropriate response sent back.


My issue is the app keeps directing the user to the login page every time it’s opened.

How do I create this call that fires off when the application is opened? Is this a lifecycle event?

I’m trying to get the user to the home screen if token is valid (code 200) or if not authorized, then and only then do they redirect to Login.


It’s contextual. There’s no only answer. You could do something here where you send the token to the backend to check it’s still current when the application enters the foreground. But this isn’t the only way.