Search code examples
androidfacebook-android-sdk

Facebook login with android sdk not working


I have integrated Facebook login to my android application. It used to work. But now it's not working. When I debugged the application I found that now LoginManager Callback is giving an Exception. I don't know what this is, and how to solve it. And this is the exception I got

exception: "SERVER_ERROR [code] 1675030 [message]: Error performing query. [extra]: Errors while executing operation "ProxyAuthAppLoginStartQuery": At Query.proxy_auth_app_login_start: Failed to resolve field."

code

public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    view = inflater.inflate(R.layout.fragment_sign_in, null);
    CardView mSignInFbButton = (CardView) view.findViewById(R.id.sign_up_fb);
    mSignInFbButton.setOnClickListener(v ->{
                if (AccessToken.getCurrentAccessToken() != null) {
                    LoginManager.getInstance().logOut();
                }
                LoginManager.getInstance().logInWithReadPermissions(SignInFragment.this, Arrays.asList("public_profile", "email"));
            }
    );
    callbackManager = CallbackManager.Factory.create();
    LoginManager.getInstance().registerCallback(callbackManager, mFBSignInCallback);
    return view;
}

private FacebookCallback mFBSignInCallback = new FacebookCallback<LoginResult>() {
    @Override
    public void onSuccess(LoginResult loginResult) {
        Beco.getApp().currentUser().signInFacebook();
    }

    @Override
    public void onCancel() {
        Log.d(TAG, "onCancel");
    }

    @Override
    public void onError(FacebookException exception) {
        Log.d(TAG, "onError");
    }
};
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);

    callbackManager.onActivityResult(requestCode, resultCode, data);

}  

In the LoginManager Callback it's going to public void onError(FacebookException exception) All suggestions are appreciated. Thanks!


Solution

  • Open your registered app in Facebook developer console.

    This method will make app publicly available for all testing devices:

    1. Select 'App Review' option
    2. Make Social Adds public? enable it to 'Yes'

    OR

    This method will let you test app on selected devices:

    1. Select 'Role' option
    2. Add 'Testers' for application