Frontend developer new to appwrite help me setting up users role based auth?
- 1
- General
- Accounts
- Web
I'm trying to create a bugtracker app with reactjs as frontend and appwrite as backend. I will be using rest api endpoints instead of javascript sdk.
My requirements are : My App supports four different user roles QA, DEV, ADMIN, PM. Each user based on his roles has certain elevated privileges.
What is the right approach in creating user sign-ups which has role based authentication and authorisation. I'm thinking of using jwt ?
Please help me with this I'm new to appwrite and backend. I tried reading documentation?
I'm curious... Why won't you be using our web sdk?
Appwrite uses teams as a way to group users so you can use that. https://appwrite.io/docs/client/teams.
FYI, Appwrite primarily uses cookies to maintain sessions rather than JWT tokens
Not using the web SDK is a personal preference. To define user roles, one approach could be to create separate teams for each role and assign users to a particular team during registration, while noting that the response object for the "Get User" endpoint "/v1/users/{userId}" does not include any property indicating the user's role and hence it is unclear how to retrieve the user's role post-login
Can you explain more on why it's your preference to not use the SDK?
The list teams API will tell you the teams you're in
To define user roles, one approach could be to create separate teams for each role and assign users to a particular team during registration Correct ✅
the response object for the "Get User" endpoint "/v1/users/{userId}" does not include any property indicating the user's role and hence it is unclear how to retrieve the user's role post-login I would use the
List Team Membershipsendpoint post-login. Once the user has logged in and a session has been created, you can make a GET request to the/v1/teams/{teamId}/membershipsendpoint. If the user is in the queried team, you'll get aMemberships List Object.
List Team Memberships: https://appwrite.io/docs/client/teams?sdk=rest-default#teamsListMemberships Memberships List Object: https://appwrite.io/docs/models/membershipList
I'm curious though - why are you not using the Web SDK? Any particular reason?
Recommended threads
- Document created without ID in console
Hi team, I’m experiencing an issue in the Appwrite console. When I create a document in a collection via the **Collections UI**, the document gets created **wi...
- Realtime doesn't seem to work with Table...
Hi, I am trying to connect my tables rows with realtime on my react website, it connects, but I dont get the rows when a row is being created. I tried with Chan...
- Failed to receive appwrite reset passwor...
Hey there, I forgot my password for my appwrite account but when i use forgot password, i dont get an email to reset the account but when i try to create a new ...