firebase-php icon indicating copy to clipboard operation
firebase-php copied to clipboard

Send a Password Redefinition email

Open brunnohofmann opened this issue 9 years ago • 8 comments

Im trying to put a option in my system for users who forget their password. In documentation I didnt found any info about it.

In firebase console I can search a user and send this email, I just wanna send the same email with a command from Kreait's library. Is it possible?

brunnohofmann avatar Nov 07 '17 15:11 brunnohofmann

I would have to reverse engineer the Firebase CLI tool to see if there is an undocumented REST API endpoint that I could use for that. But as far as I see, it is not possible to get a list of users or search for a user via the REST API (see https://firebase.google.com/docs/reference/rest/auth/).

This library aims to replicate the functionality that is provided by the official SDKs (https://firebase.google.com/docs/reference/admin/), and those don't provide this feature as well.

So the official Firebase CLI tool would be the tool to use in this case.

jeromegamez avatar Nov 07 '17 15:11 jeromegamez

On this reference (https://firebase.google.com/docs/reference/rest/auth/) I found these orientations. Reading what I wrote, I was not clear. I wanna provide a unique email, and then send a password reset email for this one.

I guess that feature can be incorporated to the library. dasd

brunnohofmann avatar Nov 07 '17 16:11 brunnohofmann

Ah, now I get it, thank you for clearing this up! This is indeed possible, I will create a new release with it shortly.

jeromegamez avatar Nov 07 '17 17:11 jeromegamez

I tried to do something with your code. I putted this on: Auth.php public function sendPasswordResetEmail(string $email): void { $response = $this->client->sendPasswordResetEmail($email); }

And this on: Auth/ApiClient.php public function sendPasswordResetEmail(string $email = null): ResponseInterface { return $this->request('getOobConfirmationCode', array_filter([ 'email' => $email, 'requestType' => "PASSWORD_RESET", ])); }

And Worked! Can u see if I did it right?

brunnohofmann avatar Nov 07 '17 19:11 brunnohofmann

You did :). I will add this to the library soon :)

jeromegamez avatar Nov 07 '17 19:11 jeromegamez

Show! Thank u so much!

brunnohofmann avatar Nov 07 '17 19:11 brunnohofmann

Here it is: https://github.com/kreait/firebase-php/releases/tag/3.4.0 - please note that the method signature is different than what you used.

jeromegamez avatar Nov 07 '17 20:11 jeromegamez

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

lock[bot] avatar Mar 15 '19 21:03 lock[bot]