簡體   English   中英

無法使用 java 在我的 facebook 牆上發帖

[英]Not able to post in my facebook wall using java

我正在嘗試使用 Java 在我的 facebook 牆上發布一條消息。 我已經標記了所有權限。 但我收到異常“FacebookOAuthException”。 請幫助解決這個問題。 提前致謝!

package com.java.sample.workouts;

import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;

import com.restfb.DefaultFacebookClient;
import com.restfb.FacebookClient;
import com.restfb.Parameter;
import com.restfb.Version;
import com.restfb.types.FacebookType;
import com.restfb.types.User;
import com.sun.media.jfxmedia.logging.Logger;

public class PostInFBWall {

    public static void updateStatus(String message) {
        FacebookClient facebookClient= new DefaultFacebookClient("access token", Version.LATEST);
         facebookClient.publish("me/feed", FacebookType.class,
                 com.restfb.Parameter.with("message", message));
    }

    public static void main(String[] args) {
        PostInFBWall.updateStatus("FB testing");
    }
}

而facebook權限的截圖是:

臉書權限

eclipse 中的例外是:

Exception in thread "main" com.restfb.exception.FacebookOAuthException: Received Facebook error response of type OAuthException: (#200) If posting to a group, requires app being installed in the group, and \
      either publish_to_groups permission with user token, or both manage_pages \
      and publish_pages permission with page token; If posting to a page, \
      requires both manage_pages and publish_pages as an admin with \
      sufficient administrative permission (code 200, subcode null)
at com.restfb.DefaultFacebookClient$DefaultGraphFacebookExceptionMapper.exceptionForTypeAndMessage(DefaultFacebookClient.java:1199)
at com.restfb.DefaultFacebookClient.throwFacebookResponseStatusExceptionIfNecessary(DefaultFacebookClient.java:1116)
at com.restfb.DefaultFacebookClient.makeRequestAndProcessResponse(DefaultFacebookClient.java:1057)
at com.restfb.DefaultFacebookClient.makeRequest(DefaultFacebookClient.java:979)
at com.restfb.DefaultFacebookClient.publish(DefaultFacebookClient.java:453)
at com.restfb.DefaultFacebookClient.publish(DefaultFacebookClient.java:478)
at com.java.sample.workouts.PostInFBWall.updateStatus(PostInFBWall.java:35)
at com.java.sample.workouts.PostInFBWall.main(PostInFBWall.java:52)

不再可能將消息或照片發布到您的用戶牆,所需的權限應該是publish_actions ,但它已被棄用。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM