Authentication on realm application not linked to database access?

Hi there,
I am working on a mini project where I am using auth0 to authenticate my users to my nextjs application. It uses mongodb as its external database to store user data. I am using realm-web sdk to query the mongodb database client side. I use the custom jwt authentication using auth0 as the external jwt service to log users in to query mongodb. However, I am not sure how does role based permissions work with the jwt authentication. It seems that the role based permissions uses the database access users instead of the users created in the atlas app through my jwt authentication. Can anybody clarify? Thank you in advance!