Facebook login with android sdk not working

I have included facebook login in my android app. It worked. But now it does not work. When I debugged the application, I found that CallManager Callback now throws an exception. I do not know what it is and how to solve it. Can someone help me? And I got this exception

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 will be public void onError(FacebookException exception) All suggestions are welcome. Thanks!

+5
source share
2 answers

Open your registered app in the Facebook Developer Console.

This method will make the application public for all testing devices:

  • Select the option "View applications"
  • Make a social supplement publicly available? enable yes

OR

This method will allow you to test the application on selected devices:

  • Select the Role option
  • Add 'Testers' for the application
+16
source

this is added when you do not rate users in your application.

enter image description here

And add test users, when you try to log in with the tested users, excuse the application without crashing.

Here are the answers from Google Groups

But I think you should use callbackManager at onCreate. Below is an example code for integrating with a Facebook signature.

  public class SignInFragment extends Fragment{ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); callbackManager = CallbackManager.Factory.create(); } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { view = inflater.inflate(R.layout.fragment_sign_in, null); LoginManager.getInstance().registerCallback(callbackManager, mFBSignInCallback); List<String> permissionNeeds = Arrays.asList("public_profile", "email"); LoginManager.getInstance().logInWithReadPermissions(SignInFragment.this, permissionNeeds); return view; } private FacebookCallback<LoginResult> mFBSignInCallback = new FacebookCallback<LoginResult>() { @Override public void onSuccess(LoginResult loginResult) { Toast.makeText(mContext, "in LoginResult on success", Toast.LENGTH_LONG).show(); @Override public void onCancel() { Log.d("VIVZ", "onCancel"); } @Override public void onError(FacebookException e) { Log.d("VIVZ", "onError " + e.getMessage()); } }; @Override public void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); callbackManager.onActivityResult(requestCode, resultCode, data); } } 
+1
source

Source: https://habr.com/ru/post/1268766/


All Articles