Starting with version 2.7, PHP Melody comes with social login integration for both the Twitter and Facebook social networks.
In this tutorial we’ve set out to cover the Facebook integration. The Twitter integration is covered in this tutorial.
We’ll take you through the steps required to create a new app in Facebook and integrate this into PHP Melody.
The ultimate goal being to allow your visitors to register and log in using only their Facebook account.
Step 1: Creating a new Facebook App
Click on the ‘Add New App‘ button, select ‘Website (www)‘ as the platform.
Enter your apps’ name and click ‘Create new Facebook App ID‘. Fill in the form and proceed to ‘Create App ID‘.
Fill in your ‘Site URL‘ and click ‘Next‘.
You’re now finished setting your Facebook App.
Step 2: Setting your new Facebook App
You should now see your new Facebook app listed under:
Click on your new app
Under ‘Products’ click + Add Product
Select ‘Facebook Login‘ and click ‘Get Started‘
You will be presented with a form.
Under ‘Valid OAuth redirect URIs‘ you need to enter your URL as such:
Save the changes.
Since the app is not yet live, you need to make it available to the public so that Facebook users can log into your PHP Melody website using their Facebook account.
Step 3: Add your Facebook APP ID and APP Secret into PHP Melody
You can now retrieve and use your App’s ID and Secret and add them into your PHP Melody installation. Here’s where to find your App ID and App Secret:
Log into your PHP Melody website’s back-end and go to Settings > User tab.
Enter your keys in the Facebook Login form which is found under the User tab.
Only thing left to do is Enable the Facebook Login, hit ‘Save Changes‘ and you’re ready to accept Facebook users.
Note: Sometimes the ‘Check App Status‘ button from your PHP Melody admin area might return an error message. You can safely ignore this error message if the front-end Facebook Login works.