Friends, I’ve got some problem. I’m using the Facebook C# SDK 6.0.10.0 for the first time and I’ve done this to connect my desktop application with facebook. I’ve used the following code…
public partial class FacebookLogin : Form
{
Uri login_url;
String redirect_url;
private FacebookOAuthResult fbAOuthResult;
public FacebookLogin()
{
InitializeComponent();
fbAOuthResult = new FacebookOAuthResult();
login_url = new Uri("https://www.facebook.com/dialog/oauth?client_id=" + ConfigurationManager.AppSettings["AppID"] + "&redirect_uri=https://www.facebook.com/connect/login_success.html&scope=user_photos,friends_photos,publish_stream&display=popup&response_type=token");
webBrowserFB.Navigate(login_url);
}
void webBrowserFB_Navigated(object sender, System.Windows.Forms.WebBrowserNavigatedEventArgs e)
{
if(fbAOuthResult.IsSuccess)
{
this.DialogResult = DialogResult.OK;
redirect_url = webBrowserFB.Url.OriginalString;
MessageBox.Show(redirect_url);
this.Close();
}
}
}
As I read the same from Facebook docs on how to connect a desktop application. But I’m getting the following error…
‘Facebook.FacebookOAuthResult.FacebookOAuthResult()’ is inaccessible due to its protection level
Please help me out in this and if I’ve missed anything anywhere or if my method is not good, you can correct me, direct me in the correct path as I’m still a college student and please provide me with the better code, if possible..:-)
Mr. Ramhound and all friends, I did it without FacebookOAuthResult() method. It was quite simple and it is working too. I dnt understand why don’t you guys online give a simple method to make the task done…
Here’s the code which I used..
Here do remember keeping the display style to “popup” inside the parameters and it will give you the prompt style login display when you navigate it through your web browser control…
You can add more permissions and even more parameters as required and every detail of it you’ll get from here. Just go through it thoroughly…
Now how to catch the response if login was succcessful…?
See the code below…
Now you can jus manipulate that redirect_url variable above in the code to manipulate it and get your access token and start doing your job better with Facebook C# SDK…
I’ll be soon uploading my application as freeware online and will be providing you with links for the same as it is the working example of this code..
If you guys have anymore queries related to this code, you can ask me here or on my Facebook page which I visit regularly..
And please I wel come good suggestions as well any improvements or better code than this…