765
Views
8
Comments
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.

2021-03-05 13-56-11
Ricardo Pereira
 
MVP

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

2026-01-26 10-25-31
Lennart Kraak
Champion

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

2020-10-18 16-19-28
Shahaji Nangare

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

Regards,

Shahaji   

2022-10-17 18-34-06
Steven Erixon

This was my initial though too.


Any pointers how I can write this if-statement?


Thank you!

2019-04-23 11-32-25
Muhammed Riyas


You can write a condition like this: 


GetUserId() <> NullIdentifier()


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

2024-01-31 05-29-41
Akshay Deshpande

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


2022-10-17 18-34-06
Steven Erixon

I got it to work! Thank you :) 

2024-01-31 05-29-41
Akshay Deshpande

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.