Open TaylorFacen opened 3 years ago
@TaylorFacen Can you please include the app code that you would expect to trigger a link to be printed? I don't think user creation in and of itself will create a link
To build on what @malcolmdeck said, thats my experience. Once you log in though, calling user.sendEmailVerification()
DOES print a URL you can visit to "verify" the emulated user's email
For me, the issue is with the interaction with Cloud Functions in the emulator. This Cloud Function runs without error, but auth does not log the verification URL:
const functions = require('firebase-functions')
const admin = require('firebase-admin')
exports.initializeUser = functions.auth.user().onCreate(async user => {
const adminUser = await admin.auth().getUser(user.uid)
await adminUser.sendEmailVerification()
})
However, if I call user.sendEmailVerification()
from the client running in the browser, it logs the verification link as expected.
For me, the issue is with the interaction with Cloud Functions in the emulator. This Cloud Function runs without error, but auth does not log the verification URL:
const functions = require('firebase-functions') const admin = require('firebase-admin') exports.initializeUser = functions.auth.user().onCreate(async user => { const adminUser = await admin.auth().getUser(user.uid) await adminUser.sendEmailVerification() })
However, if I call
user.sendEmailVerification()
from the client running in the browser, it logs the verification link as expected.
To log email verification link with Cloud Functions into console you can try this:
const functions = require('firebase-functions')
const admin = require('firebase-admin')
exports.initializeUser = functions.auth.user().onCreate(async user => {
const email = user.email!
const verificationLink = await admin.auth().generateEmailVerificationLink(email)
functions.logger.log(verificationLink)
})
[REQUIRED] Environment info
firebase version 8.17.0
MacOS Big Sur 11.0.1
[REQUIRED] Test case
The documentation here says
"For testing email verification/sign-in with email link flows, the emulator prints a URL to the terminal at which firebase emulators:start was executed."
However, when creating a user via the auth emulator or via the web app client, no URL is printed to the terminal. The user is created in auth emulator.
[REQUIRED] Steps to reproduce
Run in terminal
export FIRESTORE_EMULATOR_HOST="localhost:8080"
export FIREBASE_AUTH_EMULATOR_HOST="localhost:9099"
The run
firebase emulators:start
[REQUIRED] Expected behavior
I expect the links to be printed in the terminal as stated by the documentation.
[REQUIRED] Actual behavior
No links are printed and I have no way to simulate email verification for the test user.
As a note, I tried having the host URLs without the quotes in my environment which didn't work either.
export FIRESTORE_EMULATOR_HOST=localhost:8080
export FIREBASE_AUTH_EMULATOR_HOST=localhost:9099
firebase-debug.log output