How to access a session object in a server side custom rpc

I have a custom RPC registered which will access some storage collections

How can I access the session object in the RPC server-side?

My goal would be to check if the session is valid, and use the ID of the user associated with the session for reading the storage

Hello @BernardoSantos,

You’d use Heroic Labs Documentation | Runtime Context to fetch the userID within the current session.

If the session is invalid the request won’t reach the RPC so you don’t need to do that check yourself, the server will do it for you.

Have a look at our project template for a server authoritative tic-tac-toe example, it might prove useful.

Best

Ah ok, thanks for the help!