I try revoking by creating my own API followed in ...
# support-questions
a
I try revoking by creating my own API followed in the ThirdPartyEmailPass for Next JS
Copy code
js
export default async function logout(req: SessionRequest, res: any) {
    await superTokensNextWrapper(
        async (next) => {
            await verifySession()(req, res, next);
        },
        req,
        res
    )
    // This will delete the session from the db and from the frontend (cookies)
    await req.session!.revokeSession();
But the button that got wrapped in
Copy code
js
const SessionAuthNoSSR = dynamic(
  new Promise((res) => {
    res(SessionAuth)
  }),
  {ssr: false}
)
Is not updating to no session state. Refreshing the page still have the same output. The only work around for now is to access the page wrapped in ThirdPartyEmailPasswordAuth That will kick user to auth page and then the button above will updated to the right state. The Button check useSessionContext() for updating the correct state
r
Hey!
So your saying that the useSessionContext in the SessionAuth wrapped component does get updated when calling your API that revokes session?
a
No, when revoking, the SessionAuth not updating... Or maybe the req.session.revokeSession() not deleting cookies?
but in the docs it says that it will delete the cookies
r
It should delete the cookies
Are you calling the API using axios?
a
yes
r
Have you added supertokens intercept to it?
a
wait... I miss adding that
r
yup.. try adding that and it should work
2 Views