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.
    .setAuthorizationBaseUrl('https://www.facebook.com/dialog/oauth')
    .setTokenUrl('https://graph.facebook.com/v2.6/oauth/access_token')
    // Set the client ID and secret, from the Google Developers Console.
      .setClientId('...')
      .setClientSecret('...')
    // Set the name of the callback function that should be invoked to complete
    // the OAuth flow.
    .setCallbackFunction('authCallback')
    // Set the property store where authorized tokens should be persisted.
    .setPropertyStore(PropertiesService.getUserProperties());
}

Learn ReactJs, React Native from akashmittal.com