232
Views
11
Comments
Solved
Use the same login for multiple apps
Application Type
Reactive
Service Studio Version
11.54.10 (Build 62419)
Platform Version
11.22.0 (Build 39710)

Hi,

I have a few internal apps in my company and trying to have just one common login for all of them. I have moved the login to the global theme consumed by all apps.

My problem is whenever I try to access any of those apps for the first time, it redirects me correctly to the login screen. But when I login it does log me in , but it stays on the same login screen, as the 'Client.LastURL' is empty since the app screen and theme are on different modules. Same thing happens when  I logout from any app. It does redirect me to the correct common login screen, but when I login again, it stays on the login screen and does not go to the app screen. 

I am pretty sure most of you have dealt with such a problem in the past. How do you built a logic so whenever you login it knows to what URL it should be redirected?

OutSystems does have documentation but not explaining how to do this. 

Any help would be much appreciated.

Thanks in advance.

Lourenco Matalonga

2023-04-06 11-24-23
Paulo Zacarias
Solution

Hi Lourenço, 

I was checking your case and perhaps I can provide you with a possible solution.

Assuming that your login page has an input parameter 'RedirectURL' and that you are using it to redirect the user after login whenever this is filled, the only issue you are having is when the user accesses the Login page without that 'RedirectURL' filled, correct?

So, imagine that the user is in one of those applications, and logs out. The logout action will be something like this:

This way, the user is redirected to the Login page and then on the login, you can use that RedirectURL. 


The issue is when that RedirectURL is empty, right?

In this case, it is a possibility that a user has access to more than 1 application, right?

Have you considered creating a Homepage on the theme that has several entries to the multiple applications you have under that common login? 

Those entries would be visible based on the roles of the logged-in user. 

If the user has access to more than one application, he/she will land on that Homepage and then he/she can select which application to use. 

If the user has access to just one of those applications, you can build some logic to redirect the user after login to the desired landing page. This can be done for instance based on roles. 

Examples:

1) User logs in and has only RoleApplication1 - redirected to the landing page of application 1 (you can have an action that will provide the landing page based on the roles the user has).

2) User logs in and has multiple roles like RoleApplication1, RoleApplication2, and RoleApplication3, user is redirected to the theme homepage and will see 3 entries, enabling the user to select which application he/she wants to use.


Hope this helps you. 

Regards, 

PZ


2023-05-30 10-05-13
Lourenço Matalonga

Hello Paulo,

this only works if login and your screen are in the same module. The destination widget does not work if your destination screen is in another module. For that you have to use the RedirectToURL and this solution does not work.

Thanks anyway.

2023-04-06 11-24-23
Paulo Zacarias

Hi Lourenço, 

You will need to use a Redirect node instead of the destination node, like this:


Edit: why do you say that this solution with the Redirect node does not work?

Regards, 

PZ

2023-05-30 10-05-13
Lourenço Matalonga

Because that input variable URL for the RedirectToUrl, is the the destination you want to go to. 

How do you pass the URL of the screen you are logging out of?

These are in different modules. Can you show an example please?

2024-05-26 08-33-15
Manuel Augusto Xavier Fonseca

e quando vocĂª faz login em qual tela ele deve redirecionĂ¡-lo?

2023-05-30 10-05-13
Lourenço Matalonga

Certo! Como o login Ă© comum para as vĂ¡rias apps nao estou a conseguir criar a logica para ele saber para qual tela de qual modulo/app ele deve ser redirencionado. Visto que o login estĂ¡ no theme a client variable vem vazia e GetOwnerUrlPath() neste caso nao funciona porque nao Ă© deste modulo que eu quero mas sim do modulo da app.

2023-04-06 11-24-23
Paulo Zacarias
Solution

Hi Lourenço, 

I was checking your case and perhaps I can provide you with a possible solution.

Assuming that your login page has an input parameter 'RedirectURL' and that you are using it to redirect the user after login whenever this is filled, the only issue you are having is when the user accesses the Login page without that 'RedirectURL' filled, correct?

So, imagine that the user is in one of those applications, and logs out. The logout action will be something like this:

This way, the user is redirected to the Login page and then on the login, you can use that RedirectURL. 


The issue is when that RedirectURL is empty, right?

In this case, it is a possibility that a user has access to more than 1 application, right?

Have you considered creating a Homepage on the theme that has several entries to the multiple applications you have under that common login? 

Those entries would be visible based on the roles of the logged-in user. 

If the user has access to more than one application, he/she will land on that Homepage and then he/she can select which application to use. 

If the user has access to just one of those applications, you can build some logic to redirect the user after login to the desired landing page. This can be done for instance based on roles. 

Examples:

1) User logs in and has only RoleApplication1 - redirected to the landing page of application 1 (you can have an action that will provide the landing page based on the roles the user has).

2) User logs in and has multiple roles like RoleApplication1, RoleApplication2, and RoleApplication3, user is redirected to the theme homepage and will see 3 entries, enabling the user to select which application he/she wants to use.


Hope this helps you. 

Regards, 

PZ


2023-05-30 10-05-13
Lourenço Matalonga

Hello Paulo,

this only works if login and your screen are in the same module. The destination widget does not work if your destination screen is in another module. For that you have to use the RedirectToURL and this solution does not work.

Thanks anyway.

2023-04-06 11-24-23
Paulo Zacarias

Hi Lourenço, 

You will need to use a Redirect node instead of the destination node, like this:


Edit: why do you say that this solution with the Redirect node does not work?

Regards, 

PZ

2023-05-30 10-05-13
Lourenço Matalonga

Because that input variable URL for the RedirectToUrl, is the the destination you want to go to. 

How do you pass the URL of the screen you are logging out of?

These are in different modules. Can you show an example please?

UserImage.jpg
Nani

Hi, Lorenco Matalonga

It is possible to switch one application to another application without login but initially you need to login.

If the user have a role then that role should public and update dependences with user role  in application which you want switch and add that role to screen.

While Switching give the application url in RedirectToURL.

That's it, i think this might help you.
Thank you

2023-05-30 10-05-13
Lourenço Matalonga

Thanks for your reply. But i am not getting how do you pass a variable (URL) through the RedirectToURL. And how can you get this info on the destination module?

2023-04-06 11-24-23
Paulo Zacarias

Hi Lourenço, 

This logout action is inside a WB (let's say menu) exposed from the theme, that is consumed on all the UI applications:

That's how I pass the URL to the Login page after performing the logout.



2023-05-30 10-05-13
Lourenço Matalonga

Thanks your solution with the RedirectToURL worked. I just did not how to pass input parameters through the RecirectToUrl. But all sorted now. Thanks

2023-04-06 11-24-23
Paulo Zacarias

Alright, you're welcome.

Glad that helped. 

Regards, 

PZ


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