RevokeAuthorization in new JavaScript Facebook SDK - facebook

what is the right way to do revokeAuthorization in new Javascript SDK?

as javascript sdk allows us to makes API calls to the Graph API or Deprecated REST API via the FB.api method, you can revoke Authorization via invoking the auth.revokeAuthorization old rest api method.
you can refer to the following fb doc for the usage of FB.api and auth.revokeAuthorization:
http://developers.facebook.com/docs/reference/javascript/FB.api/
http://developers.facebook.com/docs/reference/rest/auth.revokeAuthorization/

Related

Given an Facebook access token, how can I determine which Graph API version generated it?

Facebook has a debug tool to inspect an individual token and review which Graph API version was used to generate it.
https://developers.facebook.com/tools/debug/accesstoken
Is there a corresponding API to determine the graph version of a token as well?
There's no way I know of to determine with which version of the Graph API an Access Token was created.
But there's an endpoint with which you can inspect the permissions give by a user:
/{user_id}/permissions
documented at https://developers.facebook.com/docs/graph-api/reference/v2.2/user/permissions/ You have to call this with a User Access Token.
Facebook added a new HTTP header for all api versions called "facebook-api-version" that returns a version string like 'v2.0' for all Graph API requests.
https://developers.facebook.com/docs/graph-api/using-graph-api/v2.0#debugging

Facebook app with REST API

Can I create a new Facebook app to use old REST api for user authentication. I would like to use the method auth.login for user authentication. Is it possible to use REST api with new facebook apps?
The Facebook's legacy REST API does not work for new Facebook apps registered after Apr/2013. However, REST API is still supported for existing Facebook app created before Apr/2013.
You will get "Error 3 : Application does not have the capability to make this API call" when trying to access REST API from the new Facebook app.
For newer Facebook app, please use Graph API to achieve the similar functionality as in the legacy REST API.
The REST API is deprecated now. Blog post here: https://developers.facebook.com/blog/post/616/

How to implement Facebook Like in non-Javascript environments

I am working in mobile environments that do not support Javascript. Is it possible to add Facebook Like functionality to a page, probably doing server-side requests to Facebook?
For a more detailed example, if I go to http://ogp.me/, there is a Like button towards the bottom of the page. Clicking on that uses Javascript, optionally signing into Facebook if the relevant cookies aren't there.
I want to provide the same functionality, but without using Javascript (clue: need to support Blackberry browsers).
My intention was to use OAuth 2.0 with standard redirects, to get an access token with which to call the Graph API.
Once I have an access token, I was expecting something like
curl https://graph.facebook.com/me/likes?access_token={a-valid-access-token}&category=Website&url={url-encoding-of-url-to-like}
where the access token has the publish_stream permission granted to it. So to be more explicit:
curl https://graph.facebook.com/me/likes?access_token={a-valid-access-token}&category=Website&url=http%3A%2F%2Fogp.me%2F
That attempt returns me a 403 response, and I've not found anything else in the fine manual
The graph api does allow you to like a graph object (see Graph API Docs / Publishing) using:
https://graph.facebook.com/OBJECT_ID/likes
However the graph object must have an existing likes connection - and there's currently no way of creating such a connection via the graph api.
But if the like connection already exists you can get the pages graph object id using FQL:
SELECT id FROM object_url WHERE url='http://youtargeturl.lnk'

Remove the application from a user using graph API

I am developing a facebook application, I want to remove my application from a user using Graph API, is there any way to do this.
When the user is connected, do:
FB.api("/me/permissions","DELETE",function(response){
console.log(response); //gives true on app delete success
});
I got this working with a serverside request using Using ASP.Net with Facebook’s Graph API and OAuth 2.0 Authentication this article as reference you get a auth token then when they redirect back to your callback you post a delete request to the graph url e.g.
"https://graph.facebook.com/person_id/permissions?access_token=token

How can I submit an fql query using Facebook graph api with only a Facebook appId but without a user signing in?

I'm trying to use the new graph api for using FQL (the old api used https://api.facebook.com/method/fql.query?query=select%20like_count,%20comment_count,%20share_count,%20click_count%20from%20link_stat%20where%20url=%22facebook.com%22),
but it looks like I need an access token to use the new api ( http://developers.facebook.com/docs/reference/rest/links.getStats/).
Is there a way to get statistics on a link without having a user logging in (a functionality like the old api)? Can this be done using only a Facebook appId?
Thanks.
Just call this url and parse the json response (obviously replacing the google.com with your page):
http://graph.facebook.com/?id=http://google.com
This url doesn't not require any kind of access token.