Take the 2-minute tour ×

I'm trying to get information regarding apprequests sent by my application (see https://developers.facebook.com/docs/reference/api/user/#apprequests), but even after providing my app access token, I'm getting this response whenever I try to access an apprequest object in the Graph API:

  "error": {
    "type": "OAuthException", 
    "code": 104

I retrieve my app access token by issueing a GET request to the following URL:


I then try to access the apprequest object by hitting


When I hit this URL, I get the error as defined above. I'm providing the access_token in the URL, so this error is either a bug or I'm misunderstanding the documentation, but I think a Facebook blog post (see https://developers.facebook.com/blog/post/464/) gets apprequest information in the exact way as I have above (getting app access token, request apprequest by hitting Graph API).

Thanks for the help!

share|improve this question

1 Answer 1

up vote 2 down vote accepted

I had the same problem just now. Probably you had solve it by now, but I will reply anyway for everyone who arrives here.

If you notice the $apprequest_utl you will see that it's something like


Here, what was supposed to be "&" is in fact "&amp;", which anyway is the same but doest not work with facebook apps with php function file_get_contents. Instead, use curl and all works fine!


function app_request ($request_string,$app_id,$app_secret,$user_id,$type) {

  $token_url = "https://graph.facebook.com/oauth/access_token?" .
    "client_id=" . $app_id .
    "&client_secret=" . $app_secret .

  $app_access_token = file_get_contents($token_url);


  $apprequest_url ="https://graph.facebook.com/" .
    $user_id .
    "/apprequests?message=" .
    $request_string . 
    "&data=" .
    $type . 
    "&" .
    $app_access_token . "&method=post";

  $result = curl($apprequest_url);
  echo "Request id number: " . $result;


  function curl($url){

        $curl = curl_init($url);
        curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1);
        curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0);
        curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0);
        curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0);
        return curl_exec($curl);


//Call the function and make the app request!

share|improve this answer

Your Answer


