Implementing Socialite to allow users to login with Facebook
Keep the track of passwords is not fun. In this section, we are going to make the app allow the user to login using Facebook! Thanks to Socialite this is super easy.
Getting ready
A fresh install of Laravel will do as I am going to work it into my existing comic book app.
How to do it…
Install the Socialite library. Make sure you read its docs for the steps needed to get the setup at https://github.com/laravel/socialite.
Set up
config/services.php
to add Facebook:Make a controller:
>php artisan make:controller FacebookAuthController
Set up the controller to do some work:
Get your key from Facebook at https://developers.facebook.com/. They have made this fairly very easy. In the end, I ended up with this dash:
Now, plug in app ID and app secret into your
.env
file, since we will use this inconfig/service.php
:Let's update the
app/Http/routes.php
route to give us the two routes that we need:Update...