Using this auth guard based on node js documentati...
# general
k
Using this auth guard based on node js documentation , in else if case :
Copy code
else if (err.type === Session.Error.TOKEN_THEFT_DETECTED) {
          Session.revokeSession(session.getHandle());
        }
how will we revoke session as it has already entered cache block , we wont be having session . Reference link used : https://supertokens.com/docs/session/common-customizations/sessions/session-verification-in-api/get-session#using-getsession-without-req--res-objects
r
hey @krrishan this is a mistake in the docs. Give me a moment
oh.. this is not from the docs
So the
err
object has
err.sessionHandle
i think
k
how can I test that ?
r
typescript should tell you
right, so it's
err.payload.sessionHandle
k
I cannot test with particular test case of theft For rest cases I am getting : >
Copy code
{
>   type: 'UNAUTHORISED',
>   payload: { clearTokens: true },
>   errMagic: 'ndskajfasndlfkj435234krjdsa',
>   fromRecipe: 'session'
> }
>
How can I be sure if sessionHandle will be there ? > as I am using any for err
r
> How can I be sure if sessionHandle will be there ? I checked in the SDK
actually, getSession never throws this error.. so you can just remove that if block
i'll update the docs as well
k
Ok thanks What is this part for ? Is it necessary ?
r
it's not needed if you are using getSession
k
Please check the docs there also we are getting the session in try block
and using that after cache block
r
these docs are for
getSessionWithoutRequestResponse
which is not the same function as
getSession
so the docs are fine
k
what are we doing with session after passing the try catch block in docs ?
r
We are updating the tokens in the response of the tokens have been updated.
k
this isnt necessary in nest js right ?
r
not necessary if you are using getSession..
2 Views