[Fixed] Restricted routes JWT


I am trying to build an application where you have to login and in which users can join private groups. I understand the login part using JWT but I can’t figure out how to restrict users from joining the private groups until they have been accepted by the group admin. When in the group they would get access to various functionalities such as posting question within that group but ONLY if they’re accepted.

any resources you could point me to would be appreciated


It really depends. But generally, any user can be a member of many groups and each group can have many members(users). so the relationship between these two entities is many-to-many.

In a SQL context, you can create a table and save (userId, groupdId) records. Then when a user requests to access a group, you can run a query on this table and check if they are eligible to join the group or not.

I guess you can do something similar in a NOSQL db too.

Leave a Reply

(*) Required, Your email will not be published