https://supertokens.com/ logo
a

Alankazam

07/05/2022, 7:19 PM
Hi, do I need to use verifySession in my APIs even if the lambda authorizer is run before that?
r

rp

07/05/2022, 7:26 PM
Hey! You don’t
a

Alankazam

07/05/2022, 7:32 PM
How can I get the session instance?
r

rp

07/05/2022, 7:34 PM
You don’t get the session instance in your lambda function. You lambda authoriser only sends the userId to the lambda function.
You can also make it send the session handle if you like and then in your lambda function you can use the sessionHandle to do operations on the session.
Alternatively, you don’t need to use lamda authorisers at all and can directly use the verifySession in your lambda functions.
And that will give you the session object
a

Alankazam

07/05/2022, 7:42 PM
Now I understand, thank you very much.
To do session operation should I use Session.getSessionInformation?
r

rp

07/05/2022, 8:07 PM
Do you have the session instant or just the sessionHandle?
a

Alankazam

07/05/2022, 8:09 PM
I have the sessionHandle, I'm getting it by the context that the authorizer sends
r

rp

07/05/2022, 8:09 PM
Instance *
Right. So you can use that function. Sure
There r a bunch of functions you can use
a

Alankazam

07/05/2022, 8:10 PM
My intention is to use updateAccessTokenPayload
r

rp

07/05/2022, 8:10 PM
Cool. there is a Session.updateAccessTokenPayload function too
a

Alankazam

07/05/2022, 8:11 PM
Oh it's true I see, thanks again
r

rp

07/05/2022, 8:12 PM
The one thing to keep in mind is that calling that with the sessionHandle will update the accessTokenPayload on the frontend only after a session refresh
If you want the frontend to have the change immediately, then you wanna use the verifySession function in the lambda function (without putting the lambda authoriser in the middle)
a

Alankazam

07/05/2022, 8:17 PM
Can I use verifySession even with lambda authorizer?
r

rp

07/05/2022, 8:17 PM
I’m not sure. You can try it. But in the lambda authoriser, you don’t need to call the verifySession then. Just make it do a no-op function or something.
a

Alankazam

07/05/2022, 8:27 PM
I assume it works, I'm testing it and let you know if it works
Yes, it worked. The authorizer runs before the lambda so it works normally.
Thanks! You have helped me a lot, congratulations for the support
3 Views