Wowza Community

REST api: Facebook live from wowza to my page on facebook

Dear, Friends.

I need help. We try to create a stream target and send a stream to Facebook via REST api.

We already created an application on Facebook and got next permissions:

manage_pages

publish_pages

publish_video

And one feature:

Live Video API

And now we try to create a stream target via REST. We have access token to application on facebook it looks like “id_app|token” and we get an access token when client login to facebook – it looks like “EAAMJyMNMrW4BALI5MKFCElVhkST86wLPSdrgY2wa1ZCJvz7T7zfvgtMWO…”

We use last one, when we create a stream target via REST.

We build a json in that way:

public static String JSON_Stream_target_reznik ="{ “application”: “stream”, " + ““enabled”: true,” + "“entryName”: “facebook_test_timeline”, " + ““facebook.accessToken”: “%s”,” + ““facebook.description”: “this stream is good”,” + ““facebook.destId”: “580359529057496”,” + ““facebook.destName”: “page”,” + ““facebook.destType”: “page”,” + ““facebook.privacy”: “onlyMe”,” + ““facebook.title”: “Live Test”,” + ““facebook.useAppSecret”: “false”,” + ““profile”: “rtmp-facebook”,” + ““sourceStreamName”: “cam.stream”}”;

We created a login button to Facebook:

<fb:login-button

data-use-continue-as=“false”

data-size=“large”

scope=“email, public_profile,email,publish_video,publish_pages,manage_pages”

onlogin=“checkLoginState();”

data-auto-logout-link=“true”

</fb:login-button>

If I use Facebook api I can get an access token to page I do it with GET

FB.api( ‘/580359529057496/?fields=access_token’, ‘GET’, function(response) {

console.log(response)

});

And I got a response - access token to my page.

We got next Errors in logs of our new stream target on wowza streaming engine:

PushPublishFacebookHandler.FBMonitor.run(facebook_test_timeline:stream/definst/cam.stream) : com.wowza.wms.pushpublish.protocol.facebook.FacebookAuthorizationException|at com.wowza.wms.pushpublish.protocol.facebook.PushPublishFacebookUtil.a(PushPublishFacebookUtil.java:559)|at com.wowza.wms.pushpublish.protocol.facebook.PushPublishFacebookUtil.getPageToken(PushPublishFacebookUtil.java:373)|at com.wowza.wms.pushpublish.protocol.facebook.PushPublishFacebook.a(PushPublishFacebook.java:373)|at com.wowza.wms.pushpublish.protocol.facebook.PushPublishFacebook.f(PushPublishFacebook.java:15)|at com.wowza.wms.pushpublish.protocol.facebook.PushPublishFacebook$FBMonitor.run(PushPublishFacebook.java:185)| PushPublishFacebookUtil.detectAuthError[getPageToken]: Please Edit the stream target in WSEM and re-login to Facebook to acquire a new access token and then Save the target PushPublishFacebookUtil.detectAuthError[getPageToken]: Authentication issue. [OAuth “Facebook Platform” “invalid_request” “Invalid appsecret_proof provided in the API argument”] PushPublishFacebookUtil.getPageToken: POST path:v3.0/580359529057496 result:400 PushPublishFacebookUtil.getPageToken-response: code: 400, payload: null, headers:{x-fb-request-id=[An72Gfyk622xasEljfjcJ5Y], x-fb-trace-id=[DDY59XbUbhb], null=[HTTP/1.1 400 Bad Request], Access-Control-Allow-Origin=[*], WWW-Authenticate=[OAuth “Facebook Platform” “invalid_request” “Invalid appsecret_proof provided in the API argument”], Connection=[keep-alive], x-fb-rev=[1000818979], Pragma=[no-cache], Date=[Wed, 12 Jun 2019 09:57:55 GMT], Strict-Transport-Security=[max-age=15552000; preload], Cache-Control=[no-store], x-app-usage=[{“call_count”:1,“total_cputime”:0,“total_time”:0}], Expires=[Sat, 01 Jan 2000 00:00:00 GMT], Content-Length=[144], X-FB-Debug=[/tra/6oYoyj1lJi6faL3NJq6ZgG9CYuWTW6BPS1jdtX8uV2XzlRWk1rdbmvWDMGoaMhOhnBjUNppaJUM4XYLfg==], Content-Type=[application/json; charset=UTF-8]} PushPublishFacebookUtil.getPageToken: url https://graph.facebook.com:443/v3.0/580359529057496?fields=access_token&access_token=&appsecret_proof= PushPublishFacebookHandler.createChildConfig(facebook_test_timeline:stream/definst/cam.stream) Acquiring page token

Thank you, for your help

WIth best regards Pavlo Reznik.

UPD:

my PushPublishMap.txt:

cam.stream={“entryName”:“facebook_test_timeline”, “profile”:“rtmp-facebook”, “facebook.destName”:“page”, “debugLogChildren”:“true”, “facebook.accessToken”:“EAAMJyMNMrW4BAOZCt0sgb6HN9HqhIeZCZA51cIie…”, “facebook.privacy”:“onlyMe”, “facebook.destType”:“page”, “application”:“stream”, “facebook.description”:“this stream is good”, “debugLog”:“true”, “destinationName”:“facebook”, “facebook.title”:“Live Test”}

as you can see, I can’t find “facebook.useAppSecret”: false, however json has it.

If I add in custom properties facebook.useAppSecret false type Boolean I have next error in my logs:

PushPublishFacebookHandler.init(facebook_test_timeline:stream/definst/cam.stream) Unsupported map key for profile:facebook.useAppSecret

and now I can see in PushPublishMap.txt:

cam.stream={“entryName”:“facebook_test_timeline”, “profile”:“rtmp-facebook”, “facebook.destName”:“page”, “debugLogChildren”:“true”, “facebook.accessToken”:“EAAMJyMNMrW4BAOZCt0sgb6HN9HqhIeZCZA51cIie…”, “facebook.destId”:“580359529057496”, “facebook.privacy”:“onlyMe”, “facebook.useAppSecret”:“false”, “facebook.destType”:“page”, “application”:“stream”, “facebook.description”:“this stream is good”, “debugLog”:“true”, “destinationName”:“facebook”, “facebook.title”:“Live Test”}

I think it’s a problem with a parser, because it can’t find a map key.

Hi @Pavlo Reznik, you’re on the right path, but our engineers would like you to submit a support ticket so they view all your log files, upload them and run some tests to find the issue. They’ll get you all set up and running- thanks.

https://www.wowza.com/support/open-ticket

When using the REST API to configure Wowza Streaming Engine to send a stream to Facebook Live, you must first use an external Facebook application that you’re developing to acquire a Facebook access token. Note the following requirements for the external Facebook application:

  • The app must have the required user and account permissions to post live videos to Facebook Live.
  • The app’s Require App Secret option must be disabled.

https://www.wowza.com/docs/send-a-stream-to-facebook-with-wowza-streaming-engine-rest-api