Join Discord
Powered by
You may be familiar of the server actions in nextj...
# support-questions-legacy
y
youscript
11/14/2023, 12:34 PM
You may be familiar of the server actions in nextjs. How do I protect the server actions for authorized usage ? We can protect the api with "withSession" helper function but as we dont have any request in server actions so I can use that func.
r
rp_st
11/14/2023, 2:30 PM
hey
@youscript
you can use this function:
https://github.com/supertokens/next.js/blob/canary/examples/with-supertokens/app/sessionUtils.ts#L11
. If you see, it takes an optional request object. So you can just call it like
await getSSRSession()
y
youscript
11/14/2023, 3:23 PM
Oh Okh Thanks
9
Views
Previous
Next