next.js
90ddc248 - (with-supertokens example): Fixes infinite redirect issue for unauthorised error during SSR (#42634)

Commit
3 years ago
(with-supertokens example): Fixes infinite redirect issue for unauthorised error during SSR (#42634) If there is an unauthorised error during `getServerSideProps`, then we return the same response as the try refresh token error so that all cookies are cleared from the frontend due to refreshing failure. If we did not do this, it would cause an infinite loop if the session was removed in offline mode as the frontend would still think that the session exists, and would redirect back to the protected route which would fail verification again.
Author
Parents
Loading