Directly login a user if current userid is not null

Hello,

I’ve spent a solid 30 minutes searching for a solution to my problem in the topics posted but couldn’t find any, so if this is a duplicate and is already solved please link it to me.

if not, the problem is I am trying to directly make the user login to his account if he already logged in before and did not log out.

Here is the block of what I tried to do, I also tried other things that did not work.

image

I do know that the problem is in “userId” that should only be used in the “Sign in” method but it is asking for a password and e-mail that I am unable to provide.

Any help would be much appreciated!

So what you all need to do is, you have to store the user id in a local storage with a tag [ ID] during signup process and when the user re-opens the app then on splash screen check if the tag [ ID ] of the local storage is not equal to blank then send user to the home screen else send to signup/login screen

1 Like

Seems logical, and then when he presses logout i remove him from the local DB right?

Yup when the user hits the logout button set the vaue of the tag [ ID ] to blank.

I tried it out, here’s the code

image

Thats once he logs in.

image

This is when he relaunches the app

If this code is correct it is not working for me :stuck_out_tongue:

Hello @user12
Here is a demo project link to understand the working of one time signin system.

:link: https://x.thunkable.com/copy/c44e9a46357df8e406d05d9a0da4a86b

//Ct tricks

2 Likes

Hello @cttricks

After 3 days of trial and error I got it to work thanks to your help, I marked you reply as the solution!

Thank you!

You welcome :blush:

Just for the benefit of any future community members who run into this issue, we also have a video outlining how to use the sign in component here: