发布到FB Page Wall时的FB Graph API OAuth 403错误

时间:2019-11-18 12:39:49

标签: android facebook-graph-api

因此,我从Graph API收到以下答复:

{Response:  responseCode: 403, graphObject: null, error: {HttpStatus: 403, errorCode: 200, subErrorCode: -1, errorType: OAuthException, errorMessage: (#200) The permission(s) publish_actions are not available. It has been deprecated. If you want to provide a way for your app users to share content to Facebook, we encourage you to use our Sharing products instead.}}

在Graph调用之前检查访问令牌权限时,我得到:

[manage_pages, publish_pages, public_profile, pages_show_list, email]

该应用程序处于开发模式,我是该页面的创建者/管理员...令人讨厌的是,该应用程序昨天运行良好,仅在用户注销并重新登录到该应用程序后才会发生。

发布代码:

    if(!AccessToken.getCurrentAccessToken().getPermissions().contains("manage_pages")){
                                    Log.d("FBToken", "Requesting new token");
                                    DatabaseReference db = FirebaseDatabase.getInstance().getReference().child("users").child(auth.getUid()).child("FBToken");
                                    db.addListenerForSingleValueEvent(new ValueEventListener() {
                                        @Override
                                        public void onDataChange(@NonNull DataSnapshot dataSnapshot) {

                                            Date date = new Date(1764547200);
//TO GENERATE ACCESS PAGE ACCESS TOKEN

                                            AccessToken token = new AccessToken(dataSnapshot.getValue().toString(),AccessToken.getCurrentAccessToken().getApplicationId(),AccessToken.getCurrentAccessToken().getUserId(),Arrays.asList("manage_pages", "publish_pages"),null, AccessTokenSource.FACEBOOK_APPLICATION_SERVICE,
                                                    AccessToken.getCurrentAccessToken().getExpires(),AccessToken.getCurrentAccessToken().getLastRefresh(),date);
                                            AccessToken.setCurrentAccessToken(token);
                                        }

                                        @Override
                                        public void onCancelled(@NonNull DatabaseError databaseError) {

                                        }
                                    });
                                }
                                Log.d("FBToken", AccessToken.getCurrentAccessToken().getPermissions().toString());
                                new GraphRequest(
                                        AccessToken.getCurrentAccessToken(),
                                        graphRequest,
                                        params,
                                        HttpMethod.POST,
                                        new GraphRequest.Callback() {
                                            public void onCompleted(GraphResponse response) {
                                               Log.d("FBPost",response.toString());
                                            }
                                        }
                                ).executeAsync();

我已经在Graph API令牌调试器中调试了访问令牌,并且它作为永不过期的页面令牌返回。在“链接”过程中,要求用户登录LogInWithPermissions(“ manage_pages”,“ publish_pages”)是否有人知道我在这里哪里出错了?

0 个答案:

没有答案