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?
Summary
The user wants help setting up role-based authentication in Appwrite as a frontend developer. One approach suggested is to create separate teams for each role and assign users to a team during registration. However, it is mentioned that the response object for the "Get User" endpoint does not include a property indicating the user's role. To retrieve the user's role post-login, the "List Team Memberships" endpoint can be used after creating a session. This will provide a list of the teams the user is in. The user mentions a preference to not use the SDK. The app is being developed with ReactJS as the frontend and Appwrite as
Drake
Admin
May 14, 2023, 05:59
I'm curious... Why won't you be using our web sdk?
FYI, Appwrite primarily uses cookies to maintain sessions rather than JWT tokens
RAM
React Developer
May 14, 2023, 06:11
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
Drake
Admin
May 14, 2023, 06:45
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
safwan
May 14, 2023, 09:00
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 Memberships endpoint 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}/memberships endpoint. If the user is in the queried team, you'll get a Memberships List Object.