You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I don't have a reproduction project, steps to reproduce are bellow.
[REQUIRED] Steps to reproduce
Start a blank firebase function project
Start emulators
Write a function :
exportconstcreationAuth=auth.user().onCreate(async(user)=>{console.log('New user created:',user.uid)constemail=user.emailif(!email){logger.error('user created without email')return}constverificationLink=awaitgetAuth().generatePasswordResetLink(email,{url: (process.env.REGISTER_REDIRECT_URL||'http://localhost:5007')+'?email='+email,})logger.info(verificationLink)// do something with verificationLink// await sendEmailWelcomeEmail(verificationLink)})
Create a user in the simulator
Check simulator logs for the created link
paste the link on firefox
mine for example : http://127.0.0.1:9099/emulator/action?mode=resetPassword&lang=en&oobCode=REDACTED&apiKey=fake-api-key&continueUrl=http%3A%2F%2Flocalhost%3A5007%2Flogin
Receive a JSON like :
{
"authEmulator": {
"error": "missing newPassword query parameter",
"instructions": "To reset the password for [email protected], send an HTTP GET request to the following URL.",
"instructions2": "You may use a web browser or any HTTP client, such as curl.",
"urlTemplate": "http://127.0.0.1:9099/emulator/action?mode=resetPassword&lang=en&oobCode=REDACTED&apiKey=fake-api-key&continueUrl=http%3A%2F%2Flocalhost%3A5007%2Flogin&newPassword=NEW_PASSWORD_HERE"
}
}
Hey @G-Cyrille, thanks for the detailed report! Let me know if I may have misunderstood, but from what I can gather, the issue here is that the emulator displays a JSON response instead of a webpage for resetting passwords.
Currently, for resetting passwords on the Auth emulator, you will need to input the new password using the provided link in the JSON response, such as:
Having JSON responses instead of UI widgets makes it easier to perform automated tests without the use of headless browsers, fake DOM API, etc. to interact with a web page.
Though I do see how matching production behavior of displaying a webpage would be useful as it would imitate the production behavior of Auth. For now, I’ll mark this as a feature request for supporting UI widgets when resetting passwords.
aalej
changed the title
function getAuth().generatePasswordResetLink(...) does not work on emulator
function getAuth().generatePasswordResetLink(...) does not display a reset password screen on the emulator
Feb 12, 2025
[REQUIRED] Environment info
firebase-tools: 13.20.0
Platform: MacOS : Sequoia 15.3
[REQUIRED] Test case
I don't have a reproduction project, steps to reproduce are bellow.
[REQUIRED] Steps to reproduce
mine for example :
http://127.0.0.1:9099/emulator/action?mode=resetPassword&lang=en&oobCode=REDACTED&apiKey=fake-api-key&continueUrl=http%3A%2F%2Flocalhost%3A5007%2Flogin
NB : this seems to be a bug for quite a while:
https://stackoverflow.com/questions/72435063/how-to-generate-password-reset-link-through-cloud-functions
[REQUIRED] Expected behavior
On step 7, the emulator should display the default "reset password screen".
[REQUIRED] Actual behavior
Error described as a JSON error in the browser
log during link creation (nb : there might be some more logs as this is a part of a bigger project) :
log during click on the link
NB : it works on production environment, it is a emulator-only issue.
The text was updated successfully, but these errors were encountered: