A generic method for making calls to the Facebook Graph API. This method can be used for Graph operations such as publishing Graph actions to the user's Facebook timeline.
To publish Graph actions, you must first configure your app for Graph actions and submit it for approval.
Note: This method is also supported in our REST API. If you wish to execute this method from your server, please refer toREST API > socialize.facebookGraphOperation.
The following table lists the available parameters:
|||graphPath||string||The Graph operation path. This is the part of Facebook's Graph URL that defines the operation. For example:|
|||method||string||Determines the HTTP method to use: "GET", "POST" or "DELETE". The default is "GET".|
A JSON object containing parameters to be passed to the Graph operation. For example:
|||authType||string||Determines whether the graph operation requires an access token or not. The supported values are:|
A reference to a callback function. Gigya calls the specified function along with the results of the API method when the API method completes.
The callback function should be defined with the following signature: functionName(Response).
The "Response Object Data Members" table below provides specification of the data that is passed to the callback function.
A string of maximum 100 characters length. The CID sets categories for transactions that can be used later for filtering reports generated by Gigya in the "Context ID" combo box. The CID allows you to associate the report information with your own internal data. For example, to identify a specific widget or page on your site/application. You should not define more than 100 different context IDs.
A developer-created object that is passed back unchanged to the application as one of the fields in the response object.
Response Object Data Members
|graphResponse||JSON Object||An object containing the response data of the Graph operation. The response is returned exactly as it is received from Facebook Graph API without translation by Gigya.|
Removing Previously Granted Permissions
It is possible to remove permissions that a user has previously agreed to, without interfering with the user's experience (they do not need to be aware of the removal). To remove permissions, you need to do the following via the Gigya WebSDK:
- Remove the permission you no longer require from your apps configuration. This prevents the scope from ever being re-requested by the app.
- Add an onLogin event handler to your site. This event handler should do 2 things:
- Determine if the user logged in via Facebook (this Method only functions when the user is currently logged into your facebook app).
- Determine if this method has been run on this particular user before, and if so, skip. You will need to set a flag in your site's Data schema after successfully removing the desired scope(s) from the user and then check for that flag here.
If the user needs to have their permission scopes pruned, run the following code to get their currently approved scopes:
The above request will return a response similar to the following, depending upon their current scopes:
If the scope you no longer want to request is listed in the 'data' array of the 'graphResponse' object, run the following method, if there are multiple scopes to be removed, you will need to run this separately for each one.
It is important to be sure that you are providing a scope in the URI of the DELETE request, otherwise the user will be completely deauthorized from your app and will be forced to re-approve your app as if they are logging into your site for the first time.
Be sure the previous request was successful. The response will contain a 'success' property in the returned 'graphResponse' object; if this is true, you then will add the aforementioned flag to your Data schema for keeping track of users that have already had their scopes adjusted:
If it is necessary to check the user's new permissions, you can run the same method call as the initial one, above, to view the newly edited scopes.
For additional information on Facebook scope management, see https://developers.facebook.com/docs/facebook-login/permissions/requesting-and-revoking/