What would it be the best way to clear the NextAuth.js session when trying to hit the backend (Apollo GraphQL) and it returns a 401 because the token has expired or is invalid?
I thought about an errorLink and signout, but as far as I know signout cannot be used server side at getServerSideProps, but only client-side.
What is the recommended way to do so? Is there any other way to implement a middleware to take care of that scenario?
Thanks