In the previous part of this walkthrough, you learned how to create a login page to allow your Experience Users to authenticate against your custom experience. This part will expand your experience to include a custom home page that only logged-in users can see.
The first step in building the home page is to create the view with the content.
Next, create the endpoint that will be returning the page we just created.
Method / Route to
/ and set the
Access Control to
Any authenticated user. We are going to use some built in endpoint features that we have not talked about yet for this endpoint, called static replies. When your endpoint does not need complicated logic, you can use static replies to immediately redirect or render a page (and so you don’t need to create a workflow).
In this case, there are two static replies - one for when there is an authenticated user, and one for when there is not. In the case where there is no authenticated user - the
Unauthorized Reply - we are choosing to redirect to
/login, to force the user to log in. In the case where there is an authenticated user, we are choosing to reply directly with the page that we created above, the
Now that the page and endpoint with static replies are created, your home page route will work. If you request the
/ route while not logged in, you’ll be redirected to
/login. At that point you can log in and then you’ll be redirected back to
/ to view your home page content.
This completes this part of the walkthrough. The following parts of this walkthrough will begin adding additional functionality that is common to most web pages.
Continue to Part 4 - User Registration