Check out example codes for "graph api facebook google script". It will help you in understanding the concepts better.

Code Example 1

function getFbService() {
  // Create a new service with the given name. The name will be used when
  // persisting the authorized token, so ensure it is unique within the
  // scope of the property store.
      return OAuth2.createService('Facebook')
    // Set the endpoint URLs.
    // Set the client ID and secret, from the Google Developers Console.
    // Set the name of the callback function that should be invoked to complete
    // the OAuth flow.
    // Set the property store where authorized tokens should be persisted.

Learn ReactJs, React Native from