Configuring Passport's Facebook Strategy
There are a few steps to configure the Passport's Facebook Strategy. We will discuss each step in detail:
- Create and set up a Facebook app. This will provide us with an
App ID
and anApp Secret
. - Add a button to our login page that allows our users to log in via Facebook.
- Add the necessary routes for Facebook authentication.
- Add a middleware method to check whether authentication is successful.
Let's dive into the details for each of the preceding steps.
Creating and setting up a Facebook app
To be able to use the Facebook Strategy, you have to build a Facebook application first. The developers, portal for Facebook is at https://developers.facebook.com/.
After logging in, click on the Get Started
button and then click on Next
.
Then, you will see a drop-down menu in the top-right corner of the screen called My Apps
, where you can find the option to create a new application.
Choose a display name that you want to name your application. In this case, we will name...