Skip to content

If facebook email permission is not granted, no error handling occurs #352

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

Closed
Alex100 opened this issue Oct 12, 2016 · 6 comments
Closed

Comments

@Alex100
Copy link

Alex100 commented Oct 12, 2016

If a user does not grant the permission for the email address:

image

There is neither an error handling in FacebookProvider.java (the caught JSONException only closes the loading dialog):

GraphRequest request = GraphRequest.newMeRequest(
                loginResult.getAccessToken(),
                new GraphRequest.GraphJSONObjectCallback() {
                    @Override
                    public void onCompleted(JSONObject object, GraphResponse response) {
                        try {
                            String email = object.getString("email");
                            mCallbackObject.onSuccess(createIDPResponse(loginResult, email));
                        } catch (JSONException e) {
                            e.printStackTrace();
                            mCallbackObject.onFailure(new Bundle());
                        }
                    }
                });

nor an error handling in AuthMethodPickerActivity.java

    @Override
    public void onFailure(Bundle extra) {
        // stay on this screen
        mActivityHelper.dismissDialog();
    }

According to the facebook permission handling guidlines https://developers.facebook.com/docs/facebook-login/handling-declined-permissions#reprompt a reprompt should be shown. This reprompt should explain why the email permission is needed

@talosdev
Copy link
Contributor

As an additional feature request, it would be nice to have the list of all denied permissions exposed to the client app.

I certainly agree that the missing email permission should be handled by the library (since it is required for Firebase to work), but it would be nice to be notified if the user has denied any other permissions.
I develop a lot of MVPs and the approach I usually follow is to simply force the user to accept all permissions.

@samtstern
Copy link
Contributor

Thanks for this report! That's an error case I had not thought about.

@samtstern
Copy link
Contributor

I think this issue was supposed to be closed when 1.0 was released by @amandle

@Alex100
Copy link
Author

Alex100 commented Nov 15, 2016

In version 1.0 is still no UI, which explains that the email is obligatory if the user has unchecked the email option and tries to log in
Steps to reproduce:

@melkir
Copy link

melkir commented Dec 11, 2016

Here is my error using the last version of FirebaseUI

E> /FacebookProvider: JSON Exception reading from Facebook GraphRequest
org.json.JSONException: No value for email
at org.json.JSONObject.get(JSONObject.java)
at org.json.JSONObject.getString(JSONObject.java)
at com.firebase.ui.auth.provider.FacebookProvider$1.onCompleted(FacebookProvider.java:141)
at com.facebook.GraphRequest$1.onCompleted(GraphRequest.java:304)
at com.facebook.GraphRequest$5.run(GraphRequest.java:1383)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:158)
at android.app.ActivityThread.main(ActivityThread.java:7229)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java)

The problem was related to this issue: http://stackoverflow.com/questions/16630972/facebook-graph-api-wont-return-email-address
After updating my primary email on Facebook the problem is gone

@thrashbun
Copy link

I don't understand the handling of this issue for Facebook. Right now the user is able to elect to not share their email address. Whether they do this or Facebook fails to return an email address anyway (because it is unverified, etc.) the user is dropped back to the Provider picker screen without being told anything failed.

As developers we have no ability to fix this at this point as we are still in the FirebaseUI activity. When the user confusedly backs out to the main activity all we can can inform them that they are still not logged in with no explanation.

In particular it is inconsistent with the way you handle emails for Twitter. On Twitter the user can also elect to keep their email private. In this case FirebaseUI works fine and registers them to the Firebase user list with a blank email address.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants