Follow the following steps to start configure your authentication endpoint and start building your own security logic.
@liveblocks/node
packageUsers can only interact with rooms they have access to. You can configure permission access in an api/auth
endpoint by creating the server/api/auth.ts
file with the following code. This is where you will implement your security and define if the current user has access to a specific room.
On the front-end, you can now replace the publicApiKey
option with authEndpoint
pointing to the endpoint you just created.
The userId
used in the authorize
function corresponds to userId used in our
APIs when setting permissions (e.g. in create room). You can use the following
example to use data from userId
and userInfo
on the front-end.