RE: How to create a special login page used ONLY for OAuth2 Authentication/

thumbnail
Dave Kliczbor, modified 4 Years ago. Junior Member Posts: 77 Join Date: 7/12/11 Recent Posts

Hi,

I'm using Liferay 7.3 and am trying to create a special login page that should be ONLY used during OAuth2 Authorization.

In Instance Settings -> OAuth2, I can set two URLs, one for authorization, one for login. Creating a page for Authorization works fine -- if I create such a page, I can set a minimalistic theme on that page and it is used nicely.

But I cannot use any other page than "/c/portal/login" as login page -- I create a hidden widget page, place a WebContent with a nice welcome message plus the login widget on it, configure it to use a minimalistic theme without header, navigation and footer, and then tell OAuth2 to use that page (by setting e.g. /web/guest/external-application-login-dialog as Login URL in the OAuth2 instance settings). That works initially ... but then the OAuth2 authorization flow does not continue after logging in; instead it redirects to itself: I now see my welcome message sans login widget (no surprise there, since I did log in) -- but I am NOT redirected to the Authorization page. I'm stuck in the middle of the OAuth2 authorization flow, because my custom page does not know the next step.

Using "/c/portal/login" here does work, but then the default login page "/web/guest/home" is being used. And that one contains navigation, header, footer... stuff that should NOT be displayed in an OAuth2 login dialog.

How do I get around that? How do I create a special login page with admin-editable content that is ONLY used during OAuth2 Authorization?

thumbnail
Marcial Calvo Valenzuela, modified 4 Years ago. New Member Posts: 4 Join Date: 4/15/20 Recent Posts

Can you consider to use /c/portal/login +  redirect parameter to redirect the user to the desired url?

#You can set the redirect manually from another application by appending
# the "redirect" parameter in a url that looks like this:
# /c/portal/login?redirect=%2Fgroup%2Femployees%2Fcalendar. This url will
# redirect the user to the path "/group/employees/calendar" upon successful
# login.

Check https://github.com/liferay/liferay-portal/blob/7.3.x/portal-impl/src/portal.properties#L3608

 

Regards

thumbnail
Dave Kliczbor, modified 4 Years ago. Junior Member Posts: 77 Join Date: 7/12/11 Recent Posts

Thanks for answering, but that does not help. I am redirected to the OAuth2 authorization page then, yes, but the authorization portlet then complains about missing the mandatory OAuth2 parameters (and since at least one of their values are cryptographic hashes that vary for each request, I cannot add them statically in the config).

I also tried various other redirects, including the OAuth2 endpoints at /o/oauth2/, I tried them url-encoded or not, no luck. Using redirect seems like a viable idea, but either there is no suitable url to redirect to, or I haven't found it yet.