Register Login

I am trying to implement a facebook connection to my site and I have a couple of questions.

1: Is it possible to register a user on my website using his current facebook email / password.

Let's say a user clicks on a link Register via facebook

and then he has to give me permissions to access his password, email, etc ... and after that I put this information into my own database and he will be able to login with that account by recording any time he wants, without having to give me permission at any time in the future.

2: If such registration is not possible, what other solution would be the best for me? Because I need to somehow track that user who is logged in with facebook, because he can upload photos, send messages, etc.

Anyway, I'm pretty new to facebook and stuff like that, so I'm really lost here, hope someone can help me :)

EDIT Thanks everyone for the great answers that helped me a lot, now all that's left is to read the documentation :)


source to share

4 answers

Yes, it is possible to get information from the user. But this is quite difficult when you have never done it.

First, you need to send the following link to the user:


Facebook will then revert your customer back to the specified uri, if the user rejected it, it will give a reason. If not, you will get the urlencoded code.

This code is required for the next step: requesting an access token:


This will return an access token if authorization has not completed.

After that, you can request the required information:


This will include a facebook uid that is unique to all users. Save it and you can distinguish between case and login.

This is roughly the same for any oauth2 application.

Facebook will not re-ask for permissions after the user grants them to you. This way you can store the access token and reuse it for the backend, and also use the same procedure you use to register for login.



  • You can never access a user's password from Facebook even with their permission, so the user always needs to authenticate with Facebook and Facebook will give you the user ID of the logged in user after successful authentication. You can store all kinds of other data locally, but not enough to authenticate the user yourself.

  • Once the user is authenticated, you will have access to the Facebook user ID through the API, which should be enough to connect all kinds of information to that particular user.



Facebook does not provide access to accounts when passwords are taken from your controls. It provides it with its own canvas for login information. Therefore, you cannot use your first approach for storing passwords in your databases. Check it out .

However, you can store email addresses after a user logs into their account using the sdks framework. Check this link for some sample C # SDK code example. You can use the Facebook APIs to fetch your email user id, photos, friends, and other information, and then play around accordingly.



  • You won't get access to the users password - only via email if you ask for it.

  • The best way would be to have a table of users and their Facebook account id.

If you want to allow users to subscribe without Facebook, you have a nullable field for their password and facebook id, as well as a username field that you can fill in with Facebook if they sign up using this route.



All Articles