firebase-js-sdk
firebase-js-sdk copied to clipboard
Email validation different between different auth functions
[REQUIRED] Describe your environment
- Operating System version: Mac OS Monterey (12.3)
- Browser version: Chrome
- Firebase SDK version: 9.8.1
- Firebase Product: auth
[REQUIRED] Describe the problem
The email validation for fetchSignInMethodsForEmail is different from linkWithCredential.
Steps to reproduce:
submit these credentials to both functions: User: test@test Password 1234
Expected behavior: Both functions return error that email is invalid.
Actual behavior:
- fetchSignInMethods returns no error.
- linkWithCredential returns an error that email is invalid.
Relevant Code:
const checkEmailFunctions = () => {
const userEmail = 'test@test'
const userPassword = '1234'
fetchSignInMethodsForEmail(auth, userEmail).catch(error => {
setErrorMessage1(error.message)
})
const currentUser = auth.currentUser
const newAuthCredential = EmailAuthProvider.credential(
userEmail,
userPassword,
)
if (currentUser) {
linkWithCredential(currentUser, newAuthCredential).catch(error => {
setErrorMessage2(error.message)
})
}
}
![image](https://user-images.githubusercontent.com/4970365/188972957-95e572dc-140e-43a3-aa95-68728c1d1a3d.png)
For anyone visiting this issue, make sure to check this: https://cloud.google.com/identity-platform/docs/admin/email-enumeration-protection