Skip to main content

Securing a website route / component

You may want to prevent rendering of some part of UI, or a route, when there's no session.

To achieve that, wrap the component tree in EmailPasswordAuth. When there's no session, this component will redirect the user to the login page.

const App = () => {    return (        <EmailPasswordAuth>            {/* MyComponent will be displayed only if session exists */}            <MyComponent />        </EmailPasswordAuth>    );}

Read more about EmailPasswordAuth in its API reference.