LWC – Fix aura.redirect Not Working

I'm developing a Community and I have a custom Login Aura controller. To log in the user I use the standard Site.login() method that returns a pageReference, that then is passed to aura.redirect()

Login Controller:

ApexPages.PageReference lgn = Site.login(username, password, startUrl);
if(!Test.isRunningTest())aura.redirect(lgn);

aura.redirect() won't navigate to Home and it doesn't throw an error either.


I've also tried to navigate to Home using NavigationMixin.Navigate but it doesn't work either.

I send a response from my controller to my LWC and there in the component I try to navigate from the login page to Home using the following code, but it just won't work

LWC:

this[NavigationMixin.Navigate]({
        type : 'standard__namedPage',
        attributes : {
            pageName : 'home'
        },
});

Any ideas on how to log in the user and then take the user from the community login page to Home using LWC?

Best Answer

Well after doing some research I found out that apparently and according to René Winkelmeyer (Salesforce Principal Developer Evangelist) in this GitHub Issue:

lightning-navigation is currently not a supported experience for Communities.

Related Topic