facebook An access token is required to request this resource - facebook

I am using facebook app to upload videos to user walls.
Note:
I have user permission for publish.
Script is fine and works for small videos with success.
I have user extended token with validity 60 days and I debugged my token and its fine with validity and have posting permissions.
my script for posting is working fine with small videos.
ISSUE
When I try to upload more than 100 MB video with only 5 or 6 min length I receive following api errors.
An access token is required to request this resource.
An active access token must be used to query information about the current user.
NOTE
When I apply small videos it works successfully.
TEST
I added same video with same length with two different sizes one is 720P with ~121MB and other is 480P with ~42MB both are same video.
But 480P with ~42MB uploaded successfully and 720P with ~121MB failed and api throws this exactly error in error log
An access token is required to request this resource.
$facebook->setAccessToken($access_token);
$facebook->setFileUploadSupport(true);
$data = $facebook->api('/'.$user_id.'/videos', 'post', $args);

The issue was resolved.
We placed this as a bug in facebook bug.
We used the code provided by Facebook support team and issue was resolved.
Facebook support response:
"We were not able to replicate this issue.
If you are still experiencing issues, can you setup a testbench on your server and run the below example to verify your implementation? If you can provide a link to the testbench with the modified code below, that would be helpful in replicating this issue.
Main code:
https://github.com/eosgood/fbphpsdk
Modification for video post:
https://gist.github.com/anonymous/6872121
We tested this on our servers with a 177MB MKV video without any failures."

Related

restfb: encountering 504 while uploading video sized 950 mb

Using restfb-1.6.12
Creating client as:
facebookClient = new DefaultFacebookClient(accessToken, new CustomWebRequestor(), new DefaultJsonMapper());
In CustomWebRequestor, customizeConnection() is overridden and following is specified:
connection.setChunkedStreamingMode(5242880);
Uploading video as:
facebookClient.publish("me/videos", FacebookType.class, BinaryAttachment.with(mediaFileName, mediaFileStream), Parameter.with("description", msg), Parameter.with("target_id", "me"), Parameter.with("metadata", 1));
Encountering following:
com.restfb.exception.FacebookNetworkException: A network error occurred while trying to communicate with Facebook: Facebook request failed (HTTP status code 504)
at com.restfb.DefaultFacebookClient.makeRequestAndProcessResponse(DefaultFacebookClient.java:625)
Upload happens as I can find the video on Facebook, but the reponse received from API doesn't tell me so. API works for videos of lesser size, like 400-500 MB. Recent change log doesn't mention any change around this either. Some help please.
Have you had a look at https://developers.facebook.com/docs/graph-api/reference/v2.0/user/videos#publish
There, Facebook states that
Videos must be encoded as multipart/form-data and published to
graph-video.facebook.com instead of the regular Graph API URL.
Also, other rules are
The aspect ratio of the video must be between 9x16 and 16x9, and the
video cannot exceed 1024MB or 180 minutes in length
Does RestFB use the correct endpoint?
Facebook fixed the problem under bug developers.facebook.com/bugs/791781120839901

Policy file error while loading new profile pictures from Facebook

As you might know, for loading images from Facebook in our application (in my case AS3) we have to load following policy file:
Security.loadPolicyFile('https://fbcdn-profile-a.akamaihd.net/crossdomain.xml');
otherwise we get following error:
SecurityError: Error #2122: Security sandbox violation: Loader.content: http://test cannot access http://profile.ak.fbcdn.net/v22941/254/15/q652310588_2173.jpg A policy file is required, but the checkPolicyFile flag was not set when this media was loaded.
you can find related question here.
I have a Facebook application that is running for long time without problem, but what I am facing today which is bizarre, is that the application gives the same security error message while loading NEW PROFILE PICTURE, and for the profile pictures that have been uploaded about 2-3 weeks ago or earlier, there is no problem.
My question is that did Facebook change its policy? Is it a problem form my side or something is wrong from Facebook? I have googled to see if the Facebook's policy or something else has been changed, but I did not found any clue.
If you go to https://fbcdn-profile-a.akamaihd.net/crossdomain.xml you will see that it returns an error (403 Forbidden: You don't have permission to access /36477/crossdomain/pics-crossdomain.xml on this server) so Flash never gets a valid crossdomain file.
This is an issue that Facebook needs to address.
I know of no way to have Flash ignore crossdomain errors.

Google Drive Sdk- Audio & Video Streaming in iOS Application

Hi Google Drive Staff,
I have tried to stream video files from Google Drive(Without Downloading). But I gets alerts that Sign In. I have went thoroughly with Dr. Edit sample App but i did not found any solution. I tried with downloadUrl , embedLink, webContentLink, alternateLink. All gives message to sign In. When i tried with exportsLinks i get a Null Message. What is the problem Here. If U have any suggestion Please Let me Know...
I have tried with Google Drive for iOS in iPod, there we can stream Video without Downloading.
Please suggest me to resolve this issue
Thanks in Advance...
I could solve it just by appending the access_token to the download url
audiofile.strPath=[NSString stringWithFormat#"%#&access_token=%#",downloadUrl,accessToken];
pass the strPath to your avplayer object to play music.
I did not try the video part. but i think a similar approach should work.
you can fetch the access token from the GTMOAuth2Authentication object
Note that you might need to refresh it if its expires.
Hope this helps you.
Regards
Nitesh
I think it depends what you mean by "stream". Last time I looked, the download links all had a content disposition: attachment header, which instructs the browser to download rather than render the content.
If you have your own client fetching the url, you can choose to ignore that header and do what you like with the content as it is fetched. imho, it would be nice if the client could add a parameter to the url to indicate to the Google servers that it wants the content to be rendered v. downloaded, but hey ho.
You need to authorize all requests to downloadLinks with an Authorization header. Read more about the authorization and learn how to retrieve your users an access token on https://developers.google.com/drive/about-auth

Why am I getting the "The user hasn't authorized the application to perform this action" error when I try to post a video (but not a photo)

I've been successfully posting from my app to user's walls for a couple of years now using the methodology defined here:
https://developers.facebook.com/docs/reference/api/post/
and now I'm switching to posting video (instead of photos) to their walls and suddenly am getting this error:
{"error":{"message":"(#200) The user hasn't authorized the application to perform this action","type":"OAuthException","code":200}}
Presumably the permissions for posting photos and videos are the same (as far as I can tell) so this is almost certainly a red herring error (not unusual for facebook). So, I'm curious if anyone else uses the /post/ method to publish content to the walls of users who have authorized your apps and I'm wondering what I'm doing wrong... After I pull the user's access token (which I have xxxed out below) the rest of my call looks like this:
post/access_token=xxxxxxxxx
&from=MyCompany
&to=user_facebook_id
&title=SomeString
&link=URL_TO_FOLLOW_BACK_FROM_FB
&source=URL_OF_VIDEO_FILE
&name=SOME_STRING
&type=video
&picture=URL_OF_THUMBNAIL
My guess is that I'm missing something in the call, but I can't figure out what it might be.
I guess this is what is different:
Video POST requests should use graph-video.facebook.com
Source: Graph API > Video

Facebook old API Video upload

Our application uploads video to facebook (using the REST API video.upload method). Everything was working fine, but nearly 10 hours ago we started to receive the error "This method must run on api-video.facebook.com". We're already running it on api-video.facebook.com! The url is http://api-video.facebook.com/restserver.php?method=video.upload, it's hardcoded in the application, and never changed. What's happening? How can this be fixed?
Since Facebook doesn't seem to want to document this:
the call is to https://api-video.facebook.com/restserver.php
params:
access_token=...
method=video.upload
The rest of the params work as before.