Hi community,
We currently have one webblock to handle log-in. We then place this webblock in the login screen for both reactive and mobile applications and users are able to login. We are looking for a way to save/reduce AOs (current license is based on AO's) and wonder if we can create a public screen containing login logic to use in multiple applications (both reactive and mobile).
Thanks in advance,
Bart
Hi Bart,
As a default in Reactive apps, the Login screen is in the Template module, which means that this screen is cloned every time you create a Reactive application.
If you want your applications to share a login screen, you can create a Style Guide where you have the Login screen in the Theme module instead of in the Template modules.
Here is a link of a lesson that really helped me to understand this:
https://www.outsystems.com/training/lesson/1235/base-style-guide-architecture?LearningPathId=17
Let me know if this was clear,
Pedro
Hi Pedro,
I never realised it was working like this. Things can be so simple sometimes :-)
Thanks for sharing!
Glad it helped! And to create the template modules you need to add the prefix Template_<module_name> so the platform understands that that module is a template and is available when you want to create a new app.
It's all explained here: https://success.outsystems.com/Documentation/11/Developing_an_Application/Design_UI/Reuse_UI/Create_a_Custom_Application_Template
Have a nice weekend :)
One more question regarding this topic. I did recreate the example in the video to understand what is happening but by default when I do login I am redirected to an error page since there is no default entry defined in the module where to login screen is.
In the login flow I do see there is a RedirectToURL defined but this is not working correctly by default. Is this correct and should I write my own code to redirect to the correct page or am I missing something?
Well, before you had one Login screen for each application and when you logged in you were redirected to the default screen of that specific application.
Now, you have one login screen that is being reused by several applications, so you need to define in the RedirectToURL action to which screen the user should go.
What probably happened was that the GetOwnerURLPath was trying to get the default screen of your theme module and there was none.
Thank you for the confirmation.
Have a nice day :-)
Hi Pedro!
i checked the example shared by @Bart Nooijens but i faced a warning:
"Redirecting to a URL coming from a screen input parameter makes your application vulnerable to open redirect attacks." It means that if I share the Login screen as dependency with multiple App/Modules I need to set the Redirect URL as external parameter. Is there any solution to avoid this warning?
I suppose that a best practice wouldn't allow this kind of warning.
Hi Lorenzo,
One of the things you could also consider is having an event instead of a RedirectUrl. With an event you could handle the login you want in each seperate app, but this is depending on your overall application landscape and the architecture you want to accomplish.
Hopefully this gives you some food for thought.
Best regards,
Bart Nooijens
Thank You Bart,
In that case I don't share the login page but oinly the login_block which has event action. In all Apps I'll have a login page including only the login_block and the action needed to handle the event.
Is that what you mean?
Best regards
Lorenzo
Yes, that's what I meant. I'm not saying it's the best thing you could do, but it is something you could do :-)
We have something similar, so we can differentiate the login options for each application.
hi @Bart Nooijens do you mind sharing how you achieved this in the end?
I also need to share the login flow across applications, but in my case we use OIDC so the login screen is on an external application.
I wonder how do you implement the login flow in the theme and then reference it from the template, because the OnException action is not available for reference. I also need to modify the logout action in UserInfo block which is also not available after reference?
Any help/ pointer would be appreciated. I watched the custom style guide architectures training but still unclear on how to implement it. Thanks
Hi Adelia,
I did check this forge component to get a good understanding on how everything could work out.
Hope this helps you.
Best,
Thank you!