Same Login module for multiple apps

Hi All,

I'm new to Outsystems and would like to ask about login/logout thing. We have already an app running and would like to build another one. Since I want to reuse the login action, I notice when I logged out from one app the other app is also got logged out.

How can I achieve:

1. If user already log in in one app, no need to login in the other app but must do user sync to local user for the first time.

2. Or, user must log in in every app and logout only effect in the the respecting app


Here is the configuration of login module currently used.

Hi Lambok,

The default implementation for login in OutSystems apps is single sign-on: the users login in any application, and the information about their roles is fetched and from that moment onwards the users are logged-in and can access (or not) any application depending on the roles they have.

What do you mean with "(...) user sync to local user for the first time"? For your second requirement, of the top of my head, the easy way is to have different users (with different usernames and app-specific roles) for different apps, or more confusing, different tenants (and users with same usernames) for different apps.

Hi Jorge,

Thanks for your prompt reply.


Then how to check if user already login in other app? I tried to put this login in Login - OnReady but it not work.

The fact GetUserId() return 0.

What I meant by  "(...) user sync to local user for the first time" is since local storage is app specific we need to store the user data to local storage. So have to find some place to do the sync with or without login.

How is the best way to achieve it?


Ohh another thing is, Jorge. We want to reuse user id so one user can use the same user id for different apps. Here we use Outsystems to build internal app in our company.


Thanks,

Lambok

Hi Lambok Sianturi,

Now I understand better your needs. You want to login on multiple, independent, native mobile apps and only provide your user credentials once.

Hi Jorge,

Thanks for your prompt reply.


Then how to check if user already login in other app? I tried to put this login in Login - OnReady but it not work.

The fact GetUserId() return 0.

What I meant by  "(...) user sync to local user for the first time" is since local storage is app specific we need to store the user data to local storage. So have to find some place to do the sync with or without login.

How is the best way to achieve it?


On mobile, each native app is independent... you will have to use some Single Sign-On solution for mobile devices/apps, I can't be of much help there (Google apps manage to do this, the same way Dropbox and others) so it should be possible. But the authentication flow will have to be after your application's splash screen, and as part of such solution, you will have to use the OutSystems platform's Login action to make sure the logged-in user information is stored for the app.

Ohh another thing is, Jorge. We want to reuse user id so one user can use the same user id for different apps. Here we use Outsystems to build internal app in our company.

There is only one User entity in OutSystems, all users will be stored there, if the same user credentials are used to login, the same User Id will be selected. You shouldn't need to do anything extra.

Sorry I can't be of more help.


Hi Jorge,

Yes, correct. I think you got my point. But I'm still curious because we can login multiple times from different independent app, but once you log out from one app the other apps will also logged out. 


If I would like to change my question, how can we make user logout from an app without other apps got logged out too? Assuming an user using the same OS user id across multiple app.


Thanks,

Lambok

Hi Lambok,

I've just tried the scenario you described (logging in with the same user in two different native mobile OutSystems apps installed on a device, and logging out in only one of them) and it didn't have any impact on the other one, so it doesn't seem to behave as you said.

To state it in clear terms, my quick test leads me to conclude that Login/Logout for native mobile apps is independent even if using the same user credentials (which is what I would expect of native apps in general).

Hi Jorge,

Ah, how did you do that? Do you use the same login module? Since we want to keep the login process the same across apps (i.e. login then OTP validation) so I create a separate module for login action like the first image I posted earlier. 

Do you think we an achieve the same behavior using the same login module?


Solution

I simply created two mobile applications based on the Phone template. They are both simply using the Users' module Users_Login action to login as I expect your common login module is using.

Have you debugged your UserLogin and UserLoginVerifyPIN to check what they are doing that could be impacting both your two consumer applications? If your are observing this behaviour it seems it may be caused by your implementation... 

Solution

Hi Jorge,

I've been busy refactoring login module since it eventually use System->Login action instead Users->User_Login action. We use the System->Login because we have requirement to login without password but by sending OTP every time user login. 

After changing it to use User-User_Login now logout is only apply to the respecting app. 

Thanks a lot for your pointer.


Regards,

Lambok