I have a requirement where I want to use Facebookaccess token using only APIs.
I have seen methods which works using web requests and responses to get the Facebook API and they also use redirect URIs.
But I cant really use redirect URI since I want to use it in a azure worker role.
Something like:
facebook a=new facebook();
a.appid="";
This is just a visualization but any help would be great.
EDIT:
Below answer helps.
and if i use following uri in browser
https://graph.facebook.com/oauth/access_token?client_id=app_Id&client_secret=secret_key&grant_type=client_credentials
it shows access_token=###
but if use following code to do the same in .net
string url = “https://graph.facebook.com/oauth/access_token?client_id=app_id
&client_secret=secretKey
&grant_type=client_credentials”;
string token;
WebRequest request = WebRequest.Create(url);
WebResponse response = request.GetResponse();
it throws unauthorized
If the C# API doesn’t provide method for it, you can do it yourself. The access token is the content of following url. You just have to make https request.
OK, so here is working PHP code: