Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Scotch.io:
Laravel Social Authentication with Socialite
Nov 17, 2016 @ 18:17:41

The Scotch.io site has posted a tutorial for the Laravel users out there showing you how to use the Socalite package in your application to make authentication handling with external services simpler.

Laravel introduced a built in Authentication module in version 5.2. To set this up, you just have to run php artisan make:auth and everything is generated for you, from the views to the controllers and the routes.

[...] And that is a great thing. However, this command will only make you a traditional login. In most sites nowadays when signing up, users have the option of signing up with a social provider such as Facebook. In this tutorial, I will teach you how to add multiple social providers to a Laravel app using Socialite package. For this tutorial we will add Facebook, Github and Twitter signups.

They start off with a new Laravel application (but, of course, you can use your current one), setting up a new database and creating a custom "users" table that includes "provider" information. The User model is then updated to allow the population of this data and the "make:auth" command is run. The Socialite package is then included and the application is configured to include its service provider. The tutorial then steps you through creating Github, Twitter and Facebook applications, getting the keys needed to drop into your app's configuration. Finally they update the login/registration pages with the social login buttons and how they'll now "magically" work.

tagged: tutorial socalite authentication laravel github twitter facebook

Link: https://scotch.io/tutorials/laravel-social-authentication-with-socialite


Trending Topics: