Back

Protection of Root Layout for Dashboard in nextjs for user authentication by using Appwrite

  • 1
  • Auth
  • Web
Drick
30 Apr, 2024, 19:16

Hello everyone, in my code i want to protetct the root layout on my next js project, only authorized/registered users should be able to login and access the children(pages) in root layout.. NB: apprwrite project id and end point are already created.

TL;DR
Developers are seeking help to protect the root layout for user authentication in a Next.js project using Appwrite. They want only authorized users to access the layout and its children pages. A possible solution suggested is to follow the guide at https://appwrite.io/docs/tutorials/nextjs-ssr-auth/step-1. Another alternative would be to check the logout button rendering and apply a similar approach to the entire page. An easier option suggested is to use https://appwrite.io/docs/quick-starts/nextjs, although potential latency issues are mentioned.
source
30 Apr, 2024, 19:21
Drick
30 Apr, 2024, 19:21

Help for the procedures/steps to be done to achieve this

Drick
30 Apr, 2024, 19:21

Thank you let me go through it

source
30 Apr, 2024, 19:22

only problem in my experience was the latency since the server is not near my location so the route redirection would majorly suck

source
30 Apr, 2024, 19:23
source
30 Apr, 2024, 19:23

check how the logout button is rendered, you can do that but for the entire page instead

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more