hi! My backend SDK will primarily verify sessions ...
# support-questions-legacy
h
hi! My backend SDK will primarily verify sessions and is sitting on an AWS Lambda as an AWS Authorizer, so the api routes would only be visible to the AWS Gateway. if this is the case, how may I enable email verification only for some routes? documentation seems it gives info only for backend SDKs that are integrated with the backend server itself: https://supertokens.com/docs/thirdpartyemailpassword/common-customizations/email-verification/protecting-routes
r
hey @heneftees
you would do session verification using any jwt lib first
and then read the
st-ev
claim from the JWT and check that
st-ev.v
is true. If it's true, the email is verified, else not. In which case you return a 403 to the frontend
h
If I understand correctly, the event param here, I can access the path and conditionally from those paths, I can then check if the email is verified or not using the method you suggested?
like if path /hello, then run a check on the claims
if its /hi then just do standard getSession flow from the documentation
r
You can use getSession with optional email verification as well
There is a section in our docs about optional email verification.
Check that out
h
https://supertokens.com/docs/emailpassword/common-customizations/sessions/session-verification-in-api/get-session#verifying-the-claims-of-a-session Think I found it. Is this what you're referring to? So I first check the path from the event in the aws lambda if it's one that we require email verification with, and if it is, then conditionally add the check for the claims using getSession
If tells you how to do email verification on certain routes only
Read “Add email verification checks to specific API routes” section
You can pass in the same arg to getSession as well
h
Ah yeah was able to check this out prior to asking, just needed your help in confirming the custom check of the path before adding the same arg in verifySession to getSession as you suggested
r
Yup
h
Thank u! Btw, does my version of supertokens-node have this? I'm using 16.6.8
it wont show up
r
It should have this.
h
r
Have you added the import statement?
h
woops! thanks for letting me know :D
3 Views