How fix bug - login with facebook
<p>I did login with facebook in the Activity</p>

<pre><code>private CallbackManager callbackManager;
private LoginButton loginFBButton;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(LAYOUT);

    callbackManager = CallbackManager.Factory.create();
    loginFBButton = (LoginButton) findViewById(R.id.loginFBButton);
    loginFBButton.setReadPermissions(Arrays.asList("email", "public_profile"));
    loginFBButton.registerCallback(callbackManager, new FacebookCallback&lt;LoginResult&gt;() {
        @Override
        public void onSuccess(LoginResult loginResult) {
            final String accessToken = loginResult.getAccessToken().getToken();
            LogTag.v("onSuccess - getToken - " + accessToken);
            GraphRequest request = GraphRequest.newMeRequest(
                    loginResult.getAccessToken(),
                    new GraphRequest.GraphJSONObjectCallback() {
                        @Override
                        public void onCompleted(JSONObject object, GraphResponse response) {
                            LogTag.v("onSuccess - " + response.toString());

                            // Application code
                            try {
                                String email = object.getString("email");
                                LogTag.v("email - " + email);
                                String name = object.getString("name");
                                LogTag.v("name - " + name);
                                saveUserData(name, email, accessToken);
                            } catch (JSONException e) {
                                e.printStackTrace();
                            }
                        }
                    });
            Bundle parameters = new Bundle();
            parameters.putString("fields", "id,name,email,gender,birthday");
            request.setParameters(parameters);
            request.executeAsync();
        }

        @Override
        public void onCancel() {
            LogTag.v("onCancel");
        }

        @Override
        public void onError(FacebookException error) {
            LogTag.v("onError - " + error.getMessage());
        }
    });
}

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    callbackManager.onActivityResult(requestCode, resultCode, data);
}
</code></pre>

<p>in gradle</p>

<pre><code>dependencies { compile 'com.facebook.android:facebook-android-sdk:4.11.0' }
</code></pre>

<p>in AndroidManifest</p>

<pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example"&gt;
&lt;uses-permission android:name="android.permission.INTERNET" /&gt;
&lt;uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /&gt;
&lt;uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /&gt;
&lt;application
    android:name=".application.MyApp"
    android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:supportsRtl="true"
    android:theme="@style/AppTheme"&gt;
    &lt;meta-data
        android:name="com.facebook.sdk.ApplicationId"
        android:value="@string/facebook_app_id" /&gt;
    &lt;activity
        android:name=".activity.ActivitySignIn"
        android:label="@string/app_name"
        android:screenOrientation="portrait"&gt;
        &lt;intent-filter&gt;
            &lt;action android:name="android.intent.action.MAIN" /&gt;
            &lt;category android:name="android.intent.category.LAUNCHER" /&gt;
        &lt;/intent-filter&gt;
    &lt;/activity&gt;
    &lt;activity
        android:name="com.facebook.FacebookActivity"
        android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation"
        android:label="@string/app_name"
        android:theme="@android:style/Theme.Translucent.NoTitleBar" /&gt;
&lt;/application&gt;
</code></pre>

<p></p>

<p>in MyApp</p>

<pre><code>public class MyApp extends Application {
@Override
public void onCreate() {
    super.onCreate();
    FacebookSdk.sdkInitialize(getApplicationContext());
}   }
</code></pre>

<p>but it does not always work on 4.4.2 - OK, in the phone (5.1) on one normal and the other hangs after login with a progress bar under which there is a notice of confirmation of access to personal data, and then triggers onCancel</p>

<p>On your phone, which it might be a bug in the log shows a link to the message:</p>

<pre><code>{       "error": {
  "message": "An access token is required to request this resource.",
  "type": "OAuthException",
  "code": 104,
  "fbtrace_id": "AV/53FbmMya"       }   }
</code></pre>

<p>What is the problem? How to solve it?</p>