graph api facebook google script code example
Example: graph api facebook google script
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());
}