This guide assumes that you already have installed Liveblocks into your project and that you’re already familiar with Firebase functions.
To do that, let’s first install @liveblocks/node package in your Firebase
functions project.
Next, create a new Firebase callable function as shown below. This is where you will implement your security and define if the current user has access to a specific room.
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 userInfoon the front end.
Then, deploy your function with firebase deploy --only functions:auth.
Here is a diagram that shows how things work behind the scenes:
To connect to Liveblocks, you need to create a Liveblocks client with
[createClient][] from the front-end and set the authEndpoint option based on
the previously created “callable function”:
Liveblocks should now be integrated with your product!