Check if user is logged in
Question
Application Type
Reactive

Hi!


Is there a way to check if a User is already logged in when he or she enters my application? 


I am trying to figure it out like this - User opens up the application and if he or she is logged in it will send them to screen B. If not, be sent to screen A (login screen).


Best regards, Steven.

Hi,

That is something already provided by the login flow in OutsystemsUI:


You just need to guarantee that you haven't Anonymous role checked in the Roles web screen:


Hope this can help.


Best regards,

Ricardo

Hi Steven,

I see some other answers that strictly speaking answer your question. I
In ways of architecture I think you should have a look at @Ricardo Pereira's answer, since this is the nicest way to do it. You have a screen that needs to be used by logged in users. If a user isn't logged in, you can use the security exception to have him redirected to a login screen. (See: https://success.outsystems.com/Documentation/11/Developing_an_Application/Implement_Application_Logic/Handle_Exceptions)

Goodluck!
Lennart

You can check UserId using the GetUserID() action and redirect your page. 

Regards,

Shahaji   

This was my initial though too.


Any pointers how I can write this if-statement?


Thank you!


You can write a condition like this: 


GetUserId() <> NullIdentifier()


If true continue with the flow, if false redirect user to the Login page.

Hello steven,

as suggested by muhammed its right used getuserid<>nullidentifier

if still that is not working for you so may be there is next level suggestion not sure that's you requirement or not but above things is not working then go through this on as well

https://www.outsystems.com/forums/discussion/44063/getuserid-mobile-cached-want-to-check-if-user-is-logged-in/

Thanks and Regards,

Akshay Deshpande


I got it to work! Thank you :) 

Hello steven,

its glad to help you if you got solution then marked as solution so if anyone needed find solution easily.

Keep coding :)

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.