Guides / Authentication - Authentication with Next.js
Alternatively, you can copy one of these examples and follow the instructions in the README:
Run the following command to install Liveblocks package:
@liveblocks/node is used from the backend to setup the authentication endpoint.
Users can only interact with rooms they have access to. You can configure permission access in an
api/auth endpoint by creating the
pages/api/auth.js 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.
Here is a diagram that shows how things work behind the scenes:
To connect to Liveblocks, you simply need to create a Liveblocks client with
createClient from the front-end and set the
authEndpoint option based on the path of the endpoint created earlier.
Liveblocks should now be integrated with your product!
Explore our examples below to see what you can do with Liveblocks.