1

Im making an app in AngularJS, My App has a scenario that a user with Admin role can create users.

I know I can create users using

$createUserWithEmailAndPassword("my@email.com", "mypassword") but it Sign outs current User.

I want just to create users,not let them Sign in immediately after registering.

I found that I can use Firebase Admin SDK for it. But I unable to initialize it in my controller as it gives error require is not defined

var admin = require("firebase-admin");

    admin.initializeApp({
        serviceAccount: "/myservice.json",
        databaseURL: "URLDB"
    });
Zaid Mirza
  • 3,540
  • 2
  • 24
  • 40

1 Answers1

2

I just responded to your comment on a previous answer:

The Firebase Admin node.js SDK should be run in a trusted environment only. Creating a user without signing them in is considered an administrative task.

You should not use the Firebase Admin SDK to add this functionality to the same app that you give to your regular users. It would be a security concern.

Community
  • 1
  • 1
Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807