After a successful Login or Register request, the Current User is automatically set. Current User automatically logs in every time your application loads, if there was one when the app closed. You will need to Logout to clear it.
The easiest way to implement Auto Login in your application is by checking if there is a Current User during the load of your Launch Screen and perform a Screen Navigation to the authenticated users section of your app.
- Create a new Screen Navigation that presents the first screen that your authenticated users should see when open the app. Tip: We would suggest setting its type to Set as Root Screen.
- Open the Screen that you have set as Launch Screen. This is the screen that will be loaded first when your application starts.
- Create a new Function that performs the Screen Navigation from the step 1, if Current User is Logged In.
- Create a new Execute a Function Event Action in the When Screen First Loads Event.
You can use the values of the Current User properties when you need to bind dynamic parameter values.
Get Current User Id Code Block returns the Record Id of the Current User in case you need to use it in a Function.
You can use this Code Block in combination with an If Code Block in order to execute different flows in your app, based on if the user is authenticated. You can check Auto-Login section.
For example, you can allow the press of a button to the authenticated users, and navigate the non-authenticated to a Login Screen.