Implementing User-Role Based Protected Routes (Pages) using Next.js & AppWrite: Seeking Guidance
- 0
- Self Hosted
- Web
Hello everyone,
I'm new to Next.js, so please bear with me as I'm still in the process of familiarizing myself with the documentation.
I'm looking to create a web app where I can secure specific routes (pages) based on user roles.
Consider this straightforward use case:
- If a user is not logged in, they should only be able to access the landing page.
- Once logged in, a user gains access to a dashboard.
- For users with the role "Moderator" in addition to being logged in, they should be able to access the same dashboard plus an additional protected page that regular users cannot access.
I'd appreciate any guidance or examples on how to implement this within the Next.js framework.
Thank you in advance!
I gathered some ideas on google mentionning Json Web Tokens, middleware or even this https://builtwith.appwrite.io/projects/645ce5e378593e15fcd1/
I recommend following that way. It's possible with JWT too but that's more recommended and is probably more straightforward than relying on JWT
Recommended threads
- i need help!
I was working on my project and I just can't stop receiving this message. Is something wrong?
- redirect_uri errors on flutter client
Hi all, I'm using the flutter client for my app to do appwrite auth and use the JWTs to send to my backend. When I try to sign in with SSO, I get this: https:/...
- Request for JWKS Endpoint and OIDC Disco...
Hey Appwrite Team, Do you have plans to support JWKS and a well-known OIDC discovery endpoint? This would let us verify Appwrite JWTs in other services using st...