Email/password authentication with MongoDB

I’m new to MongoDB and I’m wondering how I can best implement email/password authentication with MongoDB for the Login activity of an Android app using the Realm Java SDK. I have already looked at the guides available, however, the guides assume that users are only contained within one class and have no other information besides credentials. For the app that I am developing, we have two classes, each representing a different role with different permissions/access levels, and each user type has other data associated to it; their first and last name for example. Currently, I am considering merging these two classes into one User class (possibly keeping those other two classes to extend the User class) and using the new User class for authentication. I am also aware that MongoDB supports custom user data. My question is: is that the best way of going about it? Or is there a more efficient solution out there that doesn’t use App Services’s Users tab (for example, retrieving input, querying the database which already has the credentials there, seeing if the information matches the input, then logging into the app if it does)?

Not a java developer, so not sure I can help you. What I would suggest is to explore the Custom Data that can be set up and also used to define rules on the device sync.