Skip to content
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

When user try with facebook login auth/missing-identifier is being returned #8678

Open
spdecodeup opened this issue Dec 13, 2024 · 6 comments
Labels
api: auth contact-support-instead Please contact Firebase Support where you can share private info about your project and get help. needs-info question

Comments

@spdecodeup
Copy link

spdecodeup commented Dec 13, 2024

Operating System

windows 11

Environment (if applicable)

Chrome 131.0.6778.139

Firebase SDK Version

11.0.2

Firebase SDK Product(s)

Auth

Project Tooling

React app with webpack and vite

Detailed Problem Description

When user try to login with there facebook account and user don't have email address in their profile. I am encounter with an error like this auth/missing-identifier.

Steps and code to reproduce issue

await signInWithPopup(auth, facebookProvider);

@spdecodeup spdecodeup added new A new issue that hasn't be categoirzed as question, bug or feature request question labels Dec 13, 2024
@google-oss-bot
Copy link
Contributor

I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.

@jbalidiong jbalidiong added api: auth needs-attention and removed needs-triage new A new issue that hasn't be categoirzed as question, bug or feature request labels Dec 13, 2024
@hsubox76
Copy link
Contributor

I think we need some more information here. Is this a new user whose very first sign-in is with Facebook, or is this an existing user that had already created an account some other way (for example, with email/password, or Google sign-in) and they're now additionally trying to sign in with Facebook login?

Does the user not have an "email address in their profile" in their existing account in your project, or they don't have an email address in their Facebook profile (I don't think this is possible?). If it's the first one, what's the other sign-in method they used before Facebook, or how was their user account created?

@spdecodeup
Copy link
Author

New User Signing in for the First Time with Facebook:

This user has never signed in to my app before.
They sign in using their Facebook account, which typically provides an email address (unless the user has explicitly hidden it or their Facebook account doesn’t have one, which is rare but possible for older accounts).

@DellaBitta
Copy link
Contributor

Hi @spdecodeup,

Two things immediately come to mind as to what could be going wrong, but I think they're all backend related and not SDK related:

  1. Have you enabled the ability to share the email address of the user in the Firebase backend, as detailed in this user video?
  2. It could be that the user explicitly did not share their email address when they signed-in to your app. If you know the user you can ask them.

If you continue to have issues then I recommend opening up a Firebase Support Ticket, since it's the backend that is responsible for fetching the user's email from Facebook and not the SDK, which is just wrapping a response from the service in a JavaScript typed object.

I hope this helps!

@spdecodeup
Copy link
Author

spdecodeup commented Dec 18, 2024

Hi @DellaBitta ,

Thanks for your insights! As per the video, our settings are enabled for both public_profile and email. The user has indeed shared their email address, but the issue seems to be that they’ve changed their Facebook email address. We reached out to Firebase Support, and they informed us that this issue is stemming from the SDK.

It seems like the SDK is not properly syncing the updated email address after the change, which could be causing the issue. We’ll keep troubleshooting on this front and will look into any further SDK updates or potential workarounds.

Additionally, with the Flutter package, the user account is being created in the users table in authentication.

Let me know if you have any additional suggestions!

@DellaBitta
Copy link
Contributor

DellaBitta commented Dec 18, 2024

Hi @spdecodeup,

I'm sorry that I misunderstood the issue yesterday. I didn't quite get the fact that the user later changed their email sharing setting.

I tested this quite a bit today and I never encountered the auth/missing-identifier error you originally mentioned. However I was able to reproduce the behavior where the email address never propagates to the Firebase account, even after deleting the Firebase Auth account in the console and generating a new one after the user's Facebook account's sharing configuration has changed.

Unfortunately I still think this is a service issue and you should reopen your older ticket with Firebase Support. Feel free to ask them to reach out to me if they have questions but I hope I have enough information in this ticket for them to investigate this further. I ensured that the errant email data was not being cached on the client side, and I have ways that this can be tested by the support team.

Here's what I've dug up today:

There seems to be an issue with caching information between the Firebase project and the Facebook project. I'm not sure if this is on the Facebook service side or the Firebase service side.

I ended up creating two Facebook projects, each with identical permissions to be able to view the user's email addresses (Use cases -> Authenticate and request data from users with Facebook login -> Customize -> email -> Add).

At first my Facebook user account had its email sharing settings set to Only Me (https://accountscenter.facebook.com/personal_info -> Personal Details -> Contact Info -> click on email address -> visibility).  I linked the Facebook App to Firebase App using the App Id and App Secret provided by Facebook. I also configured the OAuth redirect URI in the Facebook App.

I signed in with my Facebook user account credentials -- the resulting Firebase user didn't have an email address. I then went to my Facebook user account and made my email address public. I deleted the user in the Firebase console and signed in again. Still no email, as you reported.

A note: whenever testing a new configuration I delete the user in the Firebase console so that each has a new User UID after signing in with the Facebook provider. I do this in an attempt to avoid getting cached data from the service.

Then, with my email address still marked as public in my Facebook user account, I created a new Facebook App and replaced the Facebook App Id and App Secret in my Firebase project console with the new Facebook App credentials. I deleted my Facebook user in the Firebase console and signed in using the Facebook provider. The resulting new Firebase user has an email address!

As a final test I reconfigured the Firebase console to use the original Facebook App. I deleted the user in the Firebase console and deleted all local data in the browser (click the icon next to the URL, Cookies and site data -> Manage on-device site data -> delete all of the options). I confirmed that the local cache of user data is cleared (Inspect -> Application -> IndexedDB -> firebaseLocalStorageDb shouldn't exist any more, if it does click Delete database).

Without changing my email sharing settings in my Facebook user account (which is still set to public) I signed in again and the resulting Firebase account didn't have an email address.

I flip back and forth between the two Facebook projects in the Firebase console without touching my Facebook user account settings, deleting the user in the Firebase console and then signing in. A Firebase user account created with the first Facebook app doesn't have an email address, whereas a Firebase user account created with the second Facebook app does.

Finally, local storage aside, one can see the Firebase service response for each configuration's users via Inspector -> Network -> accounts.lookup. The responses with the first Facebook app don't include an email address, whereas the second Facebook app configuration does.

I hope this helps you and the Firebase support team!

Edit: I should point out that the second Facebook App still returns an email address for my Facebook user despite having subsequently reset the Facebook user's email address sharing config to Only me again, then deleting and creating a new Firebase user with that Facebook user account's credentials.

@DellaBitta DellaBitta added needs-info contact-support-instead Please contact Firebase Support where you can share private info about your project and get help. and removed needs-attention labels Dec 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: auth contact-support-instead Please contact Firebase Support where you can share private info about your project and get help. needs-info question
Projects
None yet
Development

No branches or pull requests

5 participants