Experience Cloud login navigation using LWC. How to redirect the user to the home page after using a session for authentication in Experience Cloud LWC?
have built a custom LWC login page under the experience builder site. It uses the site. login method and custom apex controller to find out the authentication of a user. After the authentication, the page goes back to LWC. When navigating to the home page, I am finding that the navigationMixin is providing a URL, which opens a new tab, but it cannot refresh the present page.
Even after applying [removed].href, the navigation problem is still there. It does not navigate the user. My question is, how can the user be redirected to the home page after the authentication happens in Experience Cloud LWC?
During the LWC login, if you find that LEC is headless, you can use invoke() method to solve the issue. Also, You can apply the following code to navigate to any page by using it to navigate backward:
Link
You can also use anchor tags for navigating to different pages. However, URLs are different for different organs, so it may not be a good option. So, consider using lightning navigation in the web and lightning components, where you can specify the name and type of a page.