One more question: yesterday I tried to do such ki...
# support-questions-legacy
i
One more question: yesterday I tried to do such kind of implementation:
Copy code
<SessionAuth 
      onSessionExpired={() => {
        console.log('AdminRoute onSessionExpired')
        navigate(RoutePaths.Onboarding)
      }} requireAuth={true}>
          {props.children}
      </SessionAuth>
to protect one of my FE routes, we don't use the built-in UI but the onSessionExpired is not being fired in case there is no session. I have tried to look through the react lib code and I found one code that tests the onSessionExpired prop but it also specifies requieredAuth={false} which doesn't make sense... do I miss something?
r
Hey. This callback is called if a session used to exist, and then it expired. Versus, a session not existing at all, in which case it won’t be fired
i
ohh, and there is no way to customize the redirect of session doesn't exists, right?
except of implementing it myself in the component
r
there is a way to customise it. one min
essentially, you can set sessionRequired={false} in the sessionAuth wrapper, and in your component, check if a session exists from the session context, and if it doesn't redirect to wherever you like
i
if I do sessionRequired={false} what is the point in wrapping it with ?
r
well actually, yea. there is no point. Sorry.. missed that suggestion.
you can just check for the session context directly in your component
i
all good 🙂 yea that is what I do
just wanted to make sure I don't miss anything that you already thought of
r
fair enough
7 Views