In this tutorial, we'll set up Facebook authentication for Conduit.
To get started, you have to create a Facebook Web Application.
Creating a Facebook Web App
Navigate to the Facebook for Developers website and sign in.
We'll be creating an app to be used for our Conduit authentication.
Select Consumer app type.
Fill the application details and finalize your app!
In this step, you will be asked to add products to your app. Select Facebook Login.
You will be asked to select a type for your application. Select WEB
.
Select Facebook Login.
Your app is ready. Make sure you download the relevant file.
Additional information on Facebook Apps.
Setting up the configuration
NOTE
Do not forget to configure the Facebook provider through the Admin Panel.
Go to the Authentication -> SIGN IN METHODS and select the Facebook provider.
Then, fill the required fields you obtained from the Facebook App.
Authenticate with Facebook
To begin authenticating with Facebook you request a redirect url with the proper scopes
curl --location --request GET 'http://localhost:3000/authentication/facebook'
{
"result": "https://www.facebook.com/v11.0/dialog/oauth?client_id=1234567890&redirect_uri=http%3A%2F%2Flocalhost%3A3000%2Fauthentication%2Ffacebook%2Fcallback&scope=email&state=eyJpZCI6IjYzNjNjZGNkMDhkNTU2MDk1NmM4MGQ4OSIsImlhdCI6MTY2OTIxMDM1MywiZXhwIjoxNjY5MjgyM30zfQ.TyvHCuyDKLiKFoEpaXRdbYoFwrzDlFiW4VdUVQJdf7U"
}
Open a browser and navigate to the url returned to you from Conduit.
Now the /hook/authentication
route has been triggered.
Once your browser has been redirected, your authentication has been completed.