Facebook C# sdk - simple Login - Where to start?
I hope you can help me. I think, to solve my problem is easy, but I am not able to find a tutorial with could help me.
I have a .net web application, not mvc. The application is written in c#, framework 3.5, and uses a sql 2008 DB. It has some login-functionality. Now i try to do my first steps with facebook c# sdk.
My first target is to allow users also to login with their facebook account. This should not be a canvas page. So I think it should be easy. It should be just a other method to login to my application. I want a button near the 'old' login Button that allows "login with your facebook account"
I think in the background, after a successful facebook-login, I have to map the facebook-user开发者_JAVA百科id with my db-user-id and it should be done. Is my strategy ok? Did i forgot something?
Now I am not sure how to start. I think all prerequirements are ok now, but do not understand what setps i have to do.
The facebook sdk has a lot of classes. Which is the right one for me?
I have something like that in my Click-Event:
string appId = "xxx";
string[] extendedPermissions = new[] { "user_about_me", "offline_access" };
if (Components.SecurityManager.Active.DoLoginOverFacebook(appId, extendedPermissions))
{
// Some code here
}
But what are the right lines of code for "Components.SecurityManager.Active.DoLoginOverFacebook()"? At the time it is empty. I dont know how to start.
Can you please help me. I tried over some nights but cant figure out where to start...
Thank you
I highly recommend you read these articles on authentication first to get the general idea.
For Facebook C# SDK v6+ - http://blog.prabir.me/post/Facebook-CSharp-SDK-Writing-your-First-Facebook-Application-v6.aspx
For Facebook C# SDK v5: - http://blog.prabir.me/post/Facebook-CSharp-SDK-Writing-your-first-Facebook-Application.aspx Then download the source code and check in "Samples" folder. We have bunch of samples there on different scenarios on how to do the authentication.
(If it is a website make sure to run the samples in either IIS or IIS express)
精彩评论