how to trigger facebook login dialog and store access tokens for multiple users

I am learning Facebook integration and want to develop a simple application in which I can log in to my multiple facebook pages and store their access tokens, so that I can use my application to post to my pages by selecting the page from list and writing a post. I have build the UI of the app but I am not able to understand how to trigger the facebook login screen multiple times and get the access token to store it in database against some id.

Can someone please guide me how to get the access token of my facebook account on server side or front end javascript?