Suppose, I have two users on this App (Teacher & Student). Their platform or home screen is different and so is the login, and registration section. Now I want the login status (student or teacher) to compare the splash screen to see who has the login and send it to its home screen. How can do this?enter image description here
CodePudding user response:
You can make role-based authorization. Here is an example.
CodePudding user response:
You need to assign a role each user, and then do the routing based on the role. 2 places where you can store the role information:
- In the Firebase Authentication token of that user as a custom claim
- In the database, either as a document associated with that user or in a table if you're using SQL. Please create a different table to store user details and use the user id as a foreign key. Do not mess with the tables generated by the authentication provider.
Always set the role from a trusted environment, otherwise your users will be able to change their own roles.
Once this is done, you can access the role information from your app and do role based authorization (in your case, routing)