question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

See original GitHub issue

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

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
thrashbuncommented, Jan 21, 2017

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.

0reactions
melkircommented, 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

Read more comments on GitHub >

github_iconTop Results From Across the Web

Handle Declined Permissions - Facebook Login
People may decline a permission because they don't understand why your app needs that information. In this case, your app could display a...
Read more >
How to Fix Auth Errors? (Facebook Permissions Error #200)
This error usually means that the ContentStudio web app has not been granted full permission to publish to your Facebook Group or Page....
Read more >
Login not working if email address is not confirmed on Facebook
If the user denies permission to the email address, login to Drupal fails (as expected) with a message Facebook login failed. This site...
Read more >
Response Codes and Errors - SAP Help Portal
errorCode errorMessage Description 0 Success. 200001 Operation canceled User canceled during the login process. 200009 Accounts linked The accounts have been linked successfully.
Read more >
Facebook Integration Error Codes and Troubleshooting Guide
The constituents of the email should contain key error information such as "Error Code", "Error SubCode", "Error Message", "Facebook Page Name".
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found