-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fetchSignInMethodsForEmail
returning nil
when email has providers associated.
#11810
Comments
As an FYI; this API appears to work on our emulators but not when using Firebase server. |
Hmm, I've just confirmed that the corresponding sample at https://github.com/firebase/firebase-ios-sdk/blob/master/FirebaseAuth/Tests/Sample/Sample/MainViewController%2BUser.m#L113 works for me, so not sure what is going on. We may need a full repro. |
Related: firebase/firebaseui-web#1040 (same issue on the web; seems to affect new projects). Has something changed with the backend https://identitytoolkit.googleapis.com/v1/accounts:createAuthUri recently? |
We have another issue related to this problem. This user reports that the issue can be replicated by enabling "Create multiple accounts for each identity provider". However, I was able to replicate across web, android & ios without it enabled. It appears to be a Firebase server issue so not sure if this is in the right repository, and apologies for flagging here. I've created a quick web script to demonstrate. It requires:
As a sanity check, I've also included sign-in. import { initializeApp } from 'firebase/app';
import {
getAuth,
fetchSignInMethodsForEmail,
signInWithEmailAndPassword,
onAuthStateChanged,
} from 'firebase/auth';
var config = {
//INSERT FIREBASE CONFIG
};
var app = initializeApp(config);
const auth = getAuth(app);
const email = 'INSERT EMAIL ADDRESS';
const password = 'INSERT PASSWORD';
onAuthStateChanged(auth, async (user) => {
if (user) {
console.log('user', user);
// ...
} else {
console.log('Signing in.....');
let userCred = await signInWithEmailAndPassword(
auth,
email,
password
);
console.log('userCred', userCred);
}
});
const button = document.getElementById('button-id');
// Attach an event listener to the button
button.addEventListener('click', async () => {
fetchSignInMethodsForEmail(auth, email)
.then((signInMethods) => {
// This produces an empty array
console.log('signInMethods', signInMethods);
})
.catch((error) => {
console.log('error', error);
});
}); |
thanks for the invsestigation @russellwheatley. Backend issue tracked internally at b/301111687 |
I have the same issue with the javascript web sdk, except that the promise resolves to [] instead of giving me the correct signinmethods. I need to use the feature to decide whether I should link a currently signed in, anonymous account with a new email link sign in method or if I should just sign in the existing account and throw away the old account. Would be very glad if this were to be fixed. |
@paulb777 Hello, can we downgrade to a specific version to make it work ? It blocks our authentication logic |
@tolotrasamuel The issue is on the server side so changing the SDK will not help. |
@paulb777 Hey, has there been any movement on this issue? It seems that implementing proper email/password auth flows has been broken for new projects for the past couple of weeks |
@sgb-io There is ongoing progress. Hopefully, we can share something soon. |
See https://cloud.google.com/identity-platform/docs/admin/email-enumeration-protection for context and a possible workaround |
I can confirm once I disabled email enumeration protection via this API call:
The provider list returned. I would say that the project I am testing against was created before the date specified this feature would be default enabled - September 15, 2023. I am going to put a note in the Firebase Flutter documentation here: https://firebase.google.com/docs/auth/flutter/email-link-auth#differentiating_emailpassword_from_email_link regarding this protection and put the PR up for review. |
I believe we can close this issue @morganchen12 |
API deprecation is in progress at #12081 |
Description
Running
fetchSignInMethodsForEmail
returnsnil
even when there are providers associated with the email account.Firebase documentation:
https://firebase.google.com/docs/reference/ios/firebaseauth/api/reference/Classes/FIRAuth#-fetchsigninmethodsforemail:completion:
I expect an array with the associated providers for the given email address.
Reproducing the issue
Setup the following API in your app with relevant Firebase setup:
Replace the "EMAIL ADDRESS WITH PROVIDER ASSOCIATED" with an email address that has providers associated in your Firebase console.
Firebase SDK Version
10.15
Xcode Version
14.3.1
Installation Method
CocoaPods
Firebase Product(s)
Authentication
Targeted Platforms
iOS
Relevant Log Output
There are no relevant logs outputted with `-FIRDebugEnabled` from app boot up or when executing the API.
If using Swift Package Manager, the project's Package.resolved
Expand
Package.resolved
snippetReplace this line with the contents of your Package.resolved.
If using CocoaPods, the project's Podfile.lock
Expand
Podfile.lock
snippetThe text was updated successfully, but these errors were encountered: