When users choose not to share their email, Ueberauth simply fails and does not ask for permission again. And because of this, users have no way to login.
For now, I’d like to force users to share their email. I found that we can do this by rerequesting Facebook OAuth permissions using /auth/facebook?scope=email,public_profile&auth_type=rerequest but I’m not sure how to add this to Ueberauth.
Dropping by to say I love Ueberauth. It is low level but just what I needed, and it was easy to make an LDAP adapter too (which I should probably release as a plugin sometime, although it does make some assumptions about our unique setup).
defp validate_auth_for_registration(auth) do
case auth.info.email do
nil -> {:error, :email_is_null}
"" -> {:error, :password_is_empty}
_ -> :ok
end
end
With this example, the authentication will get an {:error, :email_is_null} when the user doesn’t give permission for their email as expected. However, if the user realizes that the application needs his/her email and decides to try again, the user will get the error message without the permission prompt. I just found that you need to remove the app from https://www.facebook.com/settings?tab=applications to try again.