Facebook Login/Register with my database - facebook

I have a website with my custom register system (really simple - username, password and e-mail).
I want to make Login with facebook as my new and only register/login system.
I want to put a login button which:
- if user is logged to facebook just asks for permission to use e-mail and other data + asks for custom username
- if user is not logged, then just facebook login
Then the user would not need to login to my page if he's logged in to Facebook.
Can you please give me a hint or suggest a framwork to do this with?

If you look on the Facebook developers page it tells you how to do this
https://developers.facebook.com/docs/guides/web/#login

Related

Login to Facebook from another application

I have a windows application. Users will login to my windows application. Once logged in, there will be a button as "Login to Facebook". The logged in users username and password for facebook is already stored in my DB and i can retrieve that information.
What I need is, once the user clicks on the "Login to Facebook" button, it should automatically go to facebook page with the User logged in by providing the Username and Password retrieved from my DB.
If this is not do-able, upon clicking the button, it should open the facebook login page and enter the Username and Password values retrieved from DB in their relevant textboxes.
This is a research project for my studies. Appreciate your help on this.
You need to go through the following to understand the facebook's login flow
https://developers.facebook.com/docs/facebook-login/web
For manualy building the login flow go through this
https://developers.facebook.com/docs/facebook-login

Can I used passport.js to login to Facebook from an app?

I and a friend are developing an app and would like to use Facebook as a way of users having their own accounts without us having to ask them to store passwords or make users for security and ease of use.
Passport.js has a facebook plugin but it talks about a redirect URL so my question is: is it actually possible to just send information like email address and password to facebook for authorisation and return the users profile without actually redirecting the user to a facebook login page.
I don't see how i could redirect the user to a facebook login while inside my app and also what on earth would i put as the callback URL? Am i just trying to use passport-facebook in the wrong way?
is it actually possible to just send information like email address and password to facebook for authorisation
No. Users are strongly discouraged from giving this information to any 3rd party app, and you are not allowed to ask users for them.
Login with username/email and password happens on Facebook, not in your app. You will get feedback from the login endpoint then that they logged in successfully.

Customized facebook login page

Can we customize facebook login/authentication page?
I want to use my own customized pop up for receiving 'Email' and 'Password' input from user so that it is consistent with the GUI of my application. Is there a facebook API to which I can pass the Email/Password details received from user?
Looking at https://developers.facebook.com/docs/reference/api/user/#permissions you cannot "create" new permissions. This has to go through Facebook so they know what permissions have been granted. This ensures that you're not just granting permissions on behalf of a user without them having actively granted them. This therefore stands to reason that you cannot style their page.
Alternatively, you could just make sure users register via an account on your site (You want a password so I assume you don't mean their facebook password) and then ask them to connect their facebook account to it. You would need to ask for their email in your form, get them to login, then connect via facebook and associate their facebook id with their account on your site.

How to get the logged in user's facebook ID?

I am using facebook connect to allow users to log-in to my site using facebook. I am using the server side authentication using OAuth in classic ASP, vbscript. I want to know if one of the following is possible:
1) Can I identify if the user has authorized my app without redirecting to the Auth dialog? ie, even before the user clicks the facebook login button to log-in to my site, is there a way I can find out if the user who is currently logged into facebook has authorized my app?
2) How can I get the facebook user Id of the user who is currently logged into facebook? This is outside the facebook authentication process. Does facebook offer some api which I can use to read the fb cookie that is set when a user logs into facebook and get the logged-in users's facebook user id?
Thanks
1) Use FB.getLoginStatus from the JavaScript SDK.
2) If he’s not connected to your app yet, then not at all. Otherwise, see 1)

Do I need a password for users who login via Facebook?

I have a website that allows a person to create an account with username/password. Once its created they can login and add their own content. Im now thinking about allowing them to login via their facebook profile, so when they go to my login there will be a button that says login with facebook. Then a window will popup to give permission to my facebook app so I can get their info. Once I do that do I need them to create a password still? Or once they initially give permission for their account I dont need a password, so when they come back to the site they just need to reconnect to their facebook profile? Hope this makes sense.
I would suggest the latter is true, and they don't need a password.
No, you dont need to save any password for facebook login. Facebook login box works great if you have implementes Facebook api correctly.
My buddy did the same thing. He has his setup to create a random password if they login via facebook as a precaution if they want to later login not via facebook but via their email or username then they have to recover the password.