Ad

(#100) "Subject Should Be A Page Account" Error When Trying To Publish Video To Facebook Page

- 1 answer

I'm trying to make an application that able to publish video to a Facebook page. I obtain list of available pages via /me/account request and get correct response:

[{
  "access_token":"XXX",
  "category":"Music Video",
  "category_list":[{"id":"1207","name":"Music Video"}],
  "name":"My mighty musical page",
  "id":"XXX",
  "tasks":["ANALYZE","ADVERTISE","MODERATE","CREATE_CONTENT","MANAGE"]
}]

after this I take the "id" value and send request to start live video, using the id value as page-id in the link:

{Request: accessToken: {AccessToken token:ACCESS_TOKEN_REMOVED permissions:[manage_pages, publish_video, publish_pages, user_videos, public_profile, pages_show_list, publish_to_groups, groups_access_member_info, email]}, graphPath: /XXX/live_videos, graphObject: null, httpMethod: POST, parameters: Bundle[{privacy={"value":"EVERYONE"}}] }

As a result I receive the following error:

{HttpStatus: 400, errorCode: 100, subErrorCode: -1, errorType: OAuthException, errorMessage: (#100) Subject should be a page account} /APP: [FacebookFramework] Attempt to start streaming to Facebook returned the error: code 100, message: (#100) Subject should be a page account {FacebookServiceException: httpResponseCode: 400, facebookErrorCode: 100, facebookErrorType: OAuthException, message: (#100) Subject should be a page account}

that actually describes nothing about what goes wrong. I have all required permissions. I am creator of the page and have admin rights. I have no idea where can I find this "correct id". Did I miss something important?

PS. Also I use similar code to post to a group and it works ok.

Ad

Answer

Yes, you were right, the problem was that I did not pass correct token when tried to start streaming. Correct token is received with /me/account response. I created token the following way

        final AccessToken currentToken = getCurrentAccessToken();
        new AccessToken (
            "XXX", //custom token string here
            currentToken.getApplicationId(),
            currentToken.getUserId(),
            currentToken.getPermissions(),
            currentToken.getDeclinedPermissions(),
            null,
            null,
            null,
            null
        );

and it works well with this new token

Ad
source: stackoverflow.com
Ad