I am working on a social website, and I want to integrate facebook login in it. But I need advice on the following;

Visitors can register on the website and login with the information they registered with.

Registered visitors can log in and create and save 'documents(plain text in online texteditor)', send requests to other users to rate their 'documents' and receive and send private messages.

I know how to do the above, but what if I want visitors to be able to use their facebook accounts to do the above, is that possible? I already know that I will be using a mysql database to save registered user accounts and their documents and private message.

And if it is, can you advice me on how to do this?

I know it sounds a little vague at the moment, but I can not tell more about it.