I have a question in regard to `SessionAuthForNext...
# support-questions-legacy
k
I have a question in regard to
SessionAuthForNextJS
- if I perform all the checks (error, session, hasToken claims etc.) then do I still need to wrap my page with
<SessionAuthForNextJS />
as [shown in the docs](https://supertokens.com/docs/thirdpartyemailpassword/nextjs/app-directory/protecting-route#using---presessionauthfornextjs-and-checking-for-sessions--pre) ? If so, why is that? I understand that it will handle the redirects appropriately (written in the docs), but isn't it a bit redundant? It's already used in the checks before the page is returned. This fragment of code says:
Copy code
tsx
// `session` will be undefined if it does not exist or has expired
if (!session) {
    // component is returned within these checks
}
Then the comment above the final return statement says roughly the same:
Copy code
tsx
/**
 * SessionAuthForNextJS will handle proper redirection for the user based on the different session states.
 * It will redirect to the login page if the session does not exist etc.
 */
return (
    <SessionAuthForNextJS>
        <div>
            Your user id is: {session.getUserId()}
        </div>
    </SessionAuthForNextJS>
);
To my understanding it would be impossible to reach this code in case of a non-existent session, since we check for it beforehand. Why wrap the page then? Are there different states of session that are not handled by all of the checks before?
12 Views