Facebook OAuth Error: Error getting user email from external provider
Bug report
Describe the bug
When setting up OAuth with Facebook Login I am getting the error "Error getting user email from external provider". I have seen this error posted several other times here, but I have not an actual solution.
- I have the scope added and when checking permissions on the Facebook Graph API Explorer it shows that the email scope is granted.
- When I try to return the email in the Facebook Graph API Explorer using
me?fields=id,name,emailit does not return the email and tells me "The email field was not returned. This may be because the email was missing, invalid or hasn't been confirmed." - The email scope states "The email permission allows your app to read a person's primary email address."
What I assume is happening is that my Facebook account is old and at some point, I deleted the original email and added my new one. Facebook is probably not setting this email as a "Primary Email" in the backend and there does not seem to be a way to do so manually on my end. It does not make sense why they would not return my email when I am using it to sign in to my Facebook account.
This issue seems to most likely be on the Facebook end and I submitted a support ticket with them. But, relying so heavily on the email return for the authentication seems to be a bit of a flaw. I would like to use Supabase as my backend service including for authentication, but it doesn't seem very reliable if any users that go to sign into my application will not be able to if they have changed their email at some point in the past.
Any additional information on if my assumption is correct, or if there is a way around this issue, besides using a different authentication service, would be great.
Thank you
To Reproduce
Don't think you will be able to reproduce it unless you have a Facebook account that has changed email addresses
I think I am having the same issue, I more recently moved over to a new email for my barely used facebook account. While testing out Supabase auth for a project it keeps giving me the "Error getting user email from external provider".
Same error here, can someone look into it?
Maybe you can find something useful here for a PR:
https://github.com/thebergamo/react-native-fbsdk-next/issues/521
I am facing the same issue too
any update for this issue?
I've found that this usually happens when a user has more than one email associated with their Facebook profile.
You can have them remove the old email addresses here:
https://accountscenter.facebook.com/personal_info
Is there any update for this issue?
Another cause of "Error getting user email from external provider" is when the user denies email address permission during Facebook OAuth flow, as illustrated below:
This is a problem because there is no easy way to recover from this, for the following 2 reasons:
- If the user changes their mind, you have to redirect them to
https://www.facebook.com/settings/applications/app_details/?app_id=${FACEBOOK_APP_ID}while asking them to remove your app from their settings and try again - The exact parameters received by the callback URI from the Supabase backend are:
error = "server_error"
error_code = "unexpected_failure"
error_description = "Error getting user email from external provider"
so you are expected to parse "error_description" in order to provide proper instructions, which is bit of an anti-pattern.
thanks @horsky that fixes the issue!
@horsky great solution brother!