title: error in login with facebook login
body: <p>I'm trying to implement a login with facebook in my application. I have already imported the sdk and set all the right settings on my developer account on facebook. But now when I try to login with facebook it redirects me right back to the loginactivity instead of the mainactivity. </p>
  
  <p>The facebook button is imported in my xml file like this:</p>
  
  <pre><code>    &lt;com.facebook.login.widget.LoginButton
          android:id="@+id/fb_login_button"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_gravity="center_horizontal"
          android:layout_marginTop="30dp"
          android:layout_marginBottom="30dp" /&gt;
  </code></pre>
  
  <p>This is what my launch activitys oncreate function looks like:</p>
  
  <pre><code>    FacebookSdk.sdkInitialize(this);
  
      callbackManager = CallbackManager.Factory.create();
  
      LoginManager.getInstance().registerCallback(callbackManager,
              new FacebookCallback&lt;LoginResult&gt;() {
                  @Override
                  public void onSuccess(LoginResult loginResult) {
                      // user successfully logged in
                      // Create login session
                      session.setLogin(true);
                      // Launch main activity
                      Intent intent = new Intent(LoginActivity.this,
                              MainActivity.class);
                      startActivity(intent);
                      finish();
                  }
  
                  @Override
                  public void onCancel() {
                      Toast.makeText(getApplicationContext(), "You cancelled while logging in, please login to gain access.", Toast.LENGTH_SHORT).show();
  
                  }
  
                  @Override
                  public void onError(FacebookException exception) {
                      Toast.makeText(getApplicationContext(), "An error appeared, please try again.", Toast.LENGTH_SHORT).show();
                  }
              });
  
  
      setContentView(R.layout.activity_login);
  </code></pre>
  
  <p>When I click the facebook login button I get redirected to the facebook app and when I successfully log in the facebook app asks for permission, but than I just get redirected to the login activity.</p>