相关疑难解决方法(0)

Firebase推出了当前用户

所以我有这个问题,每当我添加一个新的用户帐户时,它就会启动已经登录的当前用户.我读了firebase api并且说" 如果新帐户已创建,则用户自动登录"但他们从未说过任何关于避免这种情况的事情.

      //ADD EMPLOYEES
      addEmployees: function(formData){
        firebase.auth().createUserWithEmailAndPassword(formData.email, formData.password).then(function(data){
          console.log(data);
        });
      },
Run Code Online (Sandbox Code Playgroud)

我是管理员,我正在为我的网站添加帐户.如果我可以添加帐户而不退出并登录新帐户,我希望如此.我能避免这种情况吗?

javascript firebase firebase-authentication

48
推荐指数
5
解决办法
2万
查看次数

如何在不登录的情况下通过 Firebase 身份验证创建新用户?

我正在开发一个企业应用程序,管理员可以在其中创建新用户(没有注册表单)。我正在使用 Firebase Auth,它在很多方面都很棒,但我的用例遇到了问题。当您使用 时firebase.auth().createUserWithEmailAndPassword(email, password),由此创建的用户将自动登录。当管理员创建用户帐户时,这显然不起作用。有什么办法可以避免这种行为吗?谢谢。

firebase firebase-authentication

8
推荐指数
1
解决办法
4793
查看次数

避免用户在创建时使用 Firebase 登录

我有一个应用程序,其中用户应该仅由管理员用户创建,问题是,当在 Firebase 中创建新用户时,应用程序使用新用户信息登录,因此原始登录用户(管理员用户)必须登录退出,然后重新登录以创建新用户。

这是我创建新用户的功能:

void createUser(
    String email,
    String password,
    String nombre,
    String dui,
    DateTime fechaNacimiento,
    String telefono,
    String nombreContacto,
    String telefonoContacto,
    DateTime fechaIngreso,
    String radio,
    File foto,
    String acceso,
  ) async {
    try {
      final auth = FirebaseAuth.instance;

      UserCredential authResult = await auth.createUserWithEmailAndPassword(
        email: email,
        password: password,
      );

      //var uploadUid = authResult.user?.uid;

      final ref = FirebaseStorage.instance
          .ref()
          .child('user_images')
          .child(authResult.user!.uid + '.jpg');

      await ref.putFile(foto);

      final url = await ref.getDownloadURL();

      await FirebaseFirestore.instance
          .collection('users')
          .doc(authResult.user!.uid)
          .set({
        'nombre': nombre,
        'dui': dui,
        'fechaNacimiento': fechaNacimiento, …
Run Code Online (Sandbox Code Playgroud)

firebase firebase-authentication flutter

1
推荐指数
1
解决办法
512
查看次数