title: Facebook Authentication Invalid Scope in Android Studio
body: <p>I'm using fragments in all my class. So the problem is when I press the Login Facebook and then after that is says "Invalid Scope: SignInFragment" SignInFragment is a class.</p>
  
  <p>This is the image when I pressed Facebook Sign in Button:
  <a href="https://i.stack.imgur.com/4g7Yz.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/4g7Yz.png" alt="enter image description here"></a></p>
  
  <p>This is the code for: <code>SignInFragment</code></p>
  
  <pre><code>import android.view.View;
  import android.view.ViewGroup;
  import android.widget.Button;
  import android.widget.EditText;
  import android.widget.ProgressBar;
  import android.widget.TextView;
  import android.widget.Toast;
  
  
  import com.facebook.AccessToken;
  import com.facebook.CallbackManager;
  import com.facebook.FacebookCallback;
  import com.facebook.FacebookException;
  import com.facebook.login.LoginResult;
  import com.facebook.login.widget.LoginButton;
  import com.google.android.gms.tasks.OnCompleteListener;
  import com.google.android.gms.tasks.Task;
  import com.google.firebase.auth.AuthCredential;
  import com.google.firebase.auth.AuthResult;
  import com.google.firebase.auth.FacebookAuthProvider;
  import com.google.firebase.auth.FirebaseAuth;
  import com.google.firebase.auth.FirebaseUser;
  
  
  import java.util.Arrays;
  
  public class SignInFragment extends Fragment implements View.OnClickListener {
  
  private static final String TAG = "SignInFragment";
  
  private TextView mEmail, mPassword, mHeading, mToRegister, mFckyou;
  private EditText eEmail, ePassword;
  private Button btnSignin;
  private ProgressBar mProgressBar;
  
  //Firebase
  private FirebaseAuth mAuth;
  private FirebaseAuth.AuthStateListener mAuthListener;
  
  //Facebook
  private CallbackManager callbackManager;
  private LoginButton loginButton;
  @Nullable
  @Override
  public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
      View view = inflater.inflate(R.layout.signin_fragment, container, false);
  
      //TextView
      mEmail = view.findViewById(R.id.tvEmail);
      mPassword = view.findViewById(R.id.tvPassword);
      mHeading = view.findViewById(R.id.heading);
      mToRegister = view.findViewById(R.id.toRegister);
      mFckyou = view.findViewById(R.id.fckyou);
      //EditText
      eEmail = view.findViewById(R.id.etEmail);
      ePassword = view.findViewById(R.id.etPassword);
      //Changing the font style of hint
      eEmail.setTypeface(Typeface.SANS_SERIF);
      ePassword.setTypeface(Typeface.SANS_SERIF);
      //Button
      btnSignin = view.findViewById(R.id.btnSignin);
      //ProgressBar
      mProgressBar = view.findViewById(R.id.progressBar);
      //Facebook
      loginButton = view.findViewById(R.id.login_button);
      //Firebase
      mAuth = FirebaseAuth.getInstance();
  
      //Progress Bar and Text view = GONE
      mProgressBar.setVisibility(View.GONE);
      mFckyou.setVisibility(View.GONE);
  
      setupFbAuth();
      navigateToReigster();
      setupFirebaseAuth();
      signInUser();
  
      return view;
  }
  
  /*
  ---------------------------------------Facebook-------------------------------------------
   */
  
  public void setupFbAuth(){
  
      callbackManager = CallbackManager.Factory.create();
      loginButton.setReadPermissions(Arrays.asList(TAG));
      loginButton.setFragment(this);
      loginButton.registerCallback(callbackManager, new FacebookCallback&lt;LoginResult&gt;() {
          @Override
          public void onSuccess(LoginResult loginResult) {
  
              handleFacebookAccessToken(loginResult.getAccessToken());
  
          }
  
          @Override
          public void onCancel() {
  
              Toast.makeText(getActivity(), "Cancelling...", Toast.LENGTH_SHORT).show();
  
          }
  
          @Override
          public void onError(FacebookException error) {
  
              Log.d(TAG, "onError: error" + error.getMessage());
  
          }
      });
  }
  
  @Override
  public void onActivityResult(int requestCode, int resultCode, Intent data) {
      callbackManager.onActivityResult(requestCode,resultCode,data);
      super.onActivityResult(requestCode, resultCode, data);
      Fragment fragment = getFragmentManager().findFragmentById(R.id.container);
      fragment.onActivityResult(requestCode, resultCode, data);
  }
  
  private void handleFacebookAccessToken(AccessToken accessToken) {
      Log.d(TAG, "handleFacebookAccessToken: " + accessToken);
  
      AuthCredential credential = FacebookAuthProvider.getCredential(accessToken.getToken());
      mAuth.signInWithCredential(credential)
              .addOnCompleteListener(new OnCompleteListener&lt;AuthResult&gt;() {
                  @Override
                  public void onComplete(@NonNull Task&lt;AuthResult&gt; task) {
  
                      if (task.isSuccessful()){
                          Toast.makeText(getActivity(), "Signed in success!", Toast.LENGTH_SHORT).show();
                          FirebaseUser user = mAuth.getCurrentUser();
                          updateUI(user);
                      }else {
  
                          Toast.makeText(getActivity(), "Authentication Failed", Toast.LENGTH_SHORT).show();
                      }
  
                  }
              });
  }
  
  private void updateUI(FirebaseUser user) {
  
      FragmentTransaction ft = getFragmentManager().beginTransaction();
      ft.replace(R.id.container, new HomeActivity());
      ft.commit();
  }
  </code></pre>