Limiting single login per device for a particular user for my app

Integrations

Hello everyone

I tried to implement a suggestion to limit one login per device on my app based on “Unique user per device” post in the community. This involved creating a locally stored variable in the device based on signup, assigning it the value of the unique UserID of the User and using conditional statement when the user logs in later to check if the value of the variable matches with the earlier stored unique UserID of the User.  However I have come across some roadblocks.

What I tried doing:

1.   I first created a App state variable called “loginCheckLocal” and set it Persisted = TRUE to store it locally.

2.     After Authentication>Create Account with Google Account, I tried to set the variable “loginCheckLocal = User ID” via Update App State as shown in the screenshot below. My idea was to check the status of “loginCheckLocal” variable when the User logs in and based on that decide if logins on multiple devices are taking place.  

3.     On the page load of the login page, I tried to set the conditional action for checking the value of the “loginCheckLocal” variable >> if the user signed up or login in the same device that value of “loginCheckLocal” variable would match with the locally stored UserID and the user would continue on the page. However, if the user logged in another device, as the value of “loginCheckLocal” is not present in the device, the test condition would fail and the user would be redirected to another page and asked to log out of other devices before continuing.    

However I encountered the following issues:

1.     The actions in the action chain after the user creates account by Google authentication is not executed as the page directly navigates to the logged in page. For the same reason, the Updated App State is skipped and neither is the variable ‘loginCheckLocal’ is set to the Userid of the authenticated user.  

2.      Authentication by Google does not differentiate between a User Signing up for the first time and Loging in after an account has been created.

I needed some guidance on the following issues :

1.     Is it possible to somehow execute actions after the user creates account by Google Authentication but before navigating to the logged in page?

2.     Is it possible to distinguish between signing up for the first time and logging in after the account has been created for Google Authentication?

3.     Lastly, I believe these functionalities can be access by using cloud function but I am avoiding this route as it requires the paid tier of Firebase (“Blaze Subscription”).

Any leads will be greatly appreciated!

What have you tried so far?

What I tried doing:

1.   I first created a App state variable called “loginCheckLocal” and set it Persisted = TRUE to store it locally.

2.     After Authentication>Create Account with Google Account, I tried to set the variable “loginCheckLocal = User ID” via Update App State as shown in the screenshot below. My idea was to check the status of “loginCheckLocal” variable when the User logs in and based on that decide if logins on multiple devices are taking place.  

3.     On the page load of the login page, I tried to set the conditional action for checking the value of the “loginCheckLocal” variable >> if the user signed up or login in the same device that value of “loginCheckLocal” variable would match with the locally stored UserID and the user would continue on the page. However, if the user logged in another device, as the value of “loginCheckLocal” is not present in the device, the test condition would fail and the user would be redirected to another page and asked to log out of other devices before continuing.   

 

Did you check FlutterFlow's Documentation for this topic?
No