Facebook OAuth错误:此请求要求用户采取待处理的操作

时间:2018-08-01 14:45:49

标签: android facebook facebook-graph-api oauth

facebook身份验证设置正确,但是每当我用于登录时,它都会打开一个对话框。如何解决此错误,以便可以使用facebook oauth按钮打开facebook应用?

  

{HttpStatus:400,错误代码:31,subErrorCode:1349174,错误类型:OAuthException,错误消息:此请求要求用户执行待处理的操作}

enter image description here

我的代码:

    //FB WORK HERE...

    cb= CallbackManager.Factory.create();

    // Callback registration
    fbBtn.registerCallback(cb, new FacebookCallback<LoginResult>() {
        @Override
        public void onSuccess(LoginResult loginResult) {
            // txtName.setText(loginResult.getAccessToken());
            GraphRequest request = GraphRequest.newMeRequest(
                    loginResult.getAccessToken(),
                    new GraphRequest.GraphJSONObjectCallback() {
                        @Override
                        public void onCompleted(JSONObject object, GraphResponse response) {
                            // Application code
                            Log.d("FBobj:",object.toString());
                            try {
                                String personName =object.getString("first_name")+" "+object.getString("last_name");
                                String personPhotoUrl = object.getString("picture");
                                String email = object.getString("email");

                                txtName.setText(personName);
                                txtEmail.setText(email);
                                Glide.with(getApplicationContext()).load(personPhotoUrl)
                                        .thumbnail(0.5f)
                                        .crossFade()
                                        .diskCacheStrategy(DiskCacheStrategy.ALL)
                                        .into(imgProfilePic);


                            } catch (JSONException e) {
                                e.printStackTrace();
                            }

                                  updateUI(true);
                        }
                    });
            Bundle parameters = new Bundle();
            parameters.putString("fields", "id,first_name,last_name,link,email,picture");
            request.setParameters(parameters);
            request.executeAsync();
        }

        @Override
        public void onCancel() {
            Toast.makeText(getApplicationContext(),"Canceled",Toast.LENGTH_SHORT).show();
        }

        @Override
        public void onError(FacebookException error) {
            Log.d("FBError:",error.toString());
        }
    });


@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);

    // Result returned from launching the Intent from GoogleSignInApi.getSignInIntent(...);
    if (requestCode == RC_SIGN_IN) {
        GoogleSignInResult result = Auth.GoogleSignInApi.getSignInResultFromIntent(data);
        gl.handleSignInResult(result);
    }

    cb.onActivityResult(requestCode, resultCode, data);
}

0 个答案:

没有答案