Search code examples
angularfirebasefirebase-authenticationangularfire2

How do you update a user in Firebase using AngularFire2?


I can easily use this to create a user:

this.af.auth.createUser({email: email, password: password});

but how do I edit the users details once they're created? (ie: Change the password or the e-mail address?). I would think something like this:

this.af.auth.updateUser({email: email, password: password});

But there's no updateUser method?


Solution

  • I have once faced this problem and have not got an angularfire2 answer yet.

    Here is a native firebase way I get through this problem.

    public auth: any;
    constructor(@Inject(FirebaseApp) firebaseApp: any) {
      this.auth = firebaseApp.auth();
    }
    
    reset(targetEmail: any) {
      this.auth.sendPasswordResetEmail(targetEmail);
    }
    

    Note:

    It seems we could not change the password directly, only to send a password reset eamil to the target email address.