react-oidc-context icon indicating copy to clipboard operation
react-oidc-context copied to clipboard

Does withAuthenticationRequired protect the whole route hierarchy ?

Open devl-up opened this issue 1 year ago • 3 comments

I have a question about the withAuthenticationRequired HOC.

Let's say my app has to be fully private, can I wrap my top level route component with it and will it protect all sub-routes ?

devl-up avatar May 08 '24 18:05 devl-up

The component passed into withAuthenticationRequired will be protected.

pamapa avatar May 13 '24 09:05 pamapa

@pamapa I get that, but will navigation to nested components trough a router be protected too ?

devl-up avatar May 13 '24 10:05 devl-up

@devl-up From what I understood whenever that component is rendered it will require authentication, so if you have the component only in a route/page of the router only that route will require authentication. To provide authentication to all routes in the router just render a parent component withAuthentication.

Chiyo-no-sake avatar May 17 '24 10:05 Chiyo-no-sake