angularionic-frameworkfirebase-authenticationrole-based

How is it possbible to program a role based authentication with firebase in Angular/Ionic, when the admin role should be able to create subaccounts?


So basically i have to program an app in Angular with ionic. There should be a admin account which should be able to create an account. This admin account should then be able to create subaccounts with the email and then there should be generated an temporary password for the subaccount.

I am pretty new to Angular/Ionic so sorry for my question. Thanks!!


Solution

  • Like Aaron wrote in comment let users create thair accounts. If you wana have controll over accaunts just make a firebase function with will disable account as soon as user create it then moderator or admin can change this status.

    Here is an triger function:

    exports.sendWelcomeEmail = functions.auth.user().onCreate((user) => {
      // To Do: Set user as disabled
    });
    

    More information you can find in a documentation: https://firebase.google.com/docs/functions/auth-events