title: How to use graph API with react-native-fbsdk?
body: <p>I read the document, both on <a href="https://github.com/facebook/react-native-fbsdk" rel="noreferrer">github</a> and <a href="https://developers.facebook.com/docs/react-native/graph-api" rel="noreferrer">Facebook developers docs</a>. <br>
  There is only sample, nothing more. No API document. <br></p>
  
  <p>The code to make a Graph API request is <br></p>
  
  <pre class="lang-js prettyprint-override"><code>const infoRequest = new GraphRequest(
    '/me',
    null,
    this._responseInfoCallback,
  );
  </code></pre>
  
  <p>And the callback<br></p>
  
  <pre class="lang-js prettyprint-override"><code>_responseInfoCallback(error: ?Object, result: ?Object) {
    if (error) {
      alert('Error fetching data: ' + error.toString());
    } else {
      alert('Success fetching data: ' + result.toString());
    }
  }
  </code></pre>
  
  <p>And here is the function to make a Graph API request<br></p>
  
  <pre class="lang-js prettyprint-override"><code>testRequestGraphAPI(){
    const infoRequest = new GraphRequest(
    '/me',
    null,
    this._responseInfoCallback,
    );   
      new GraphRequestManager().addRequest(infoRequest).start();
  }
  </code></pre>
  
  <p>However, I can't find any further document. I have no idea what each parameters do. <br></p>
  
  <p>The result for these codes above is this.<br>
  <a href="https://i.stack.imgur.com/t3ScF.png" rel="noreferrer"><img src="https://i.stack.imgur.com/t3ScF.png" alt="Success"></a> <br>
  I also don't know how to get the result. </p>
  
  <p>However, when I try to modify '\me' to 'me?fields=id,name', It failed.
  Although I have asked for permission </p>
  
  <pre class="lang-js prettyprint-override"><code>&lt;LoginButton
    publishPermissions={["publish_actions,user_birthday, user_religion_politics, user_relationships, user_relationship_details, user_hometown, user_location, user_likes, user_education_history, user_work_history, user_website, user_managed_groups, user_events, user_photos, user_videos, user_friends, user_about_me, user_status, user_games_activity, user_tagged_places, user_posts, user_actions.video, user_actions.news, user_actions.books, user_actions.music, user_actions.fitness, public_profile, basic_info"]}
    onLoginFinished={
      (error, result) =&gt; {
        if (error) {
          alert("login has error: " + result.error);
        } else if (result.isCancelled) {
          alert("login is cancelled.");
        } else {
          AccessToken.getCurrentAccessToken().then(
            (data) =&gt; {
              meow_accesstoken = data.accessToken
              alert(meow_accesstoken.toString())
            }
          )
        }
      }
    }
    onLogoutFinished={() =&gt; alert("logout.")}/&gt;  
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/DEQ5B.png" rel="noreferrer"><img src="https://i.stack.imgur.com/DEQ5B.png" alt="Failed"></a><br>
  But it does not print out what error, just object Object.</p>
  
  <p>So, the problem is that I don't understand the sample code which Facebook provide with no explanation.<br></p>
  
  <p>Here is my question that I really need you help me: <br>
  First at all, please check the <a href="https://gist.github.com/ttpro1995/a07195682451b6dada6fa189f3ca5e68" rel="noreferrer">javascript code</a> that I currently looking at? <br>
  How to use <strong>graph API</strong> in <strong>react-native-fbsdk</strong> to retrieve some <strong>user information</strong> (example: full name) and successfully <strong>display</strong> it (use alert) ? <br> 
  What each parameters in <strong>GraphRequest()</strong> do ? <br>
  What is the structure of <strong>error</strong> object and <strong>result</strong> object in <strong>_responseInfoCallback</strong> ?</p>
  
  <p><strong>SOLUTION</strong> <br>
  Thanks to @Samuel answer, I have updated my code</p>
  
  <pre class="lang-js prettyprint-override"><code>testRequestGraphAPI: function(){    
          const infoRequest = new GraphRequest(
            '/me',
            {
              parameters: {
                fields: {
                  string: 'email,name,first_name,middle_name,last_name' // what you want to get
                },
                access_token: {
                  string: meow_accesstoken.toString() // put your accessToken here
                }
              }
            },
            this._responseInfoCallback // make sure you define _responseInfoCallback in same class
          );
      new GraphRequestManager().addRequest(infoRequest).start();
    }
  </code></pre>
  
  <p>And the callback</p>
  
  <pre class="lang-js prettyprint-override"><code>  _responseInfoCallback: function(error: ?Object, result: ?Object) {
      alert("meow response");
      if (error) {
        alert('Error fetching data: ' + error.toString());
        console.log(Object.keys(error));// print all enumerable 
        console.log(error.errorMessage); // print error message
        // error.toString() will not work correctly in this case
        // so let use JSON.stringify()
        meow_json = JSON.stringify(error); // error object =&gt; json 
        console.log(meow_json); // print JSON 
      } else {
        alert('Success fetching data: ' + result.toString());
        console.log(Object.keys(result)); 
        meow_json = JSON.stringify(result); // result =&gt; JSON
        console.log(meow_json); // print JSON
      } 
    }
  </code></pre>
  
  <p>*Note: For console.log(), you need to use "Debug JS remotely" then open Chrome developer tools to see the log.</p>