First we’ll have to create a free account with okta and follow the steps here.

Now lets create our OktaAuthComponent HOC which will take care of all our subsequent components that needs auth to proceed.

Now in our main app where we declare our routes we add this piece here.

So now we have a Okta React component which takes care of our auth for all the subsequent routes.

Not quite.

The trouble here is that withAuth actually gives us a prop called auth which has a couple of helper functions which help us to getUser details and much more to expose these in our child components we have to modify the router so that it takes the auth and passes it to our child components

What we did here is that we made a clone of the child components and pass the props explicitly under passedProps and modified our routes as