We will cover how to implement Google, Twitter, GitHub, Facebook & Many Other Social Generic Logins With PHP Laravel Socialite. This package is really awesome for all social logins.
We will cover the following
If you have already setup Laravel then skip to the next step. Let’s install Laravel application with the composer.
composer create-project --prefer-dist laravel/laravel socialite_testing
If you would like to learn more on the composer have written an article on it @ What Is Composer? How Does It Work? Useful Composer Commands And Usage
For working with any social login we are having a cool official package from Laravel Socialite. Let’s integrate it on our project using composer with the following command
composer require laravel/socialite
I have written other articles which cover how to get the OAuth Tokens step by step. Kindly check the articles in the following links
Facebook Login With PHP Laravel Socialite
GitHub Login With PHP Laravel Socialite
The above process remains standard and all you need to do is go and collect the OAuth keys.
Basically we need to store the **Provider Type**
and **Provider Auth Token**
in our database so that we can verify the user for later usage
Schema::create('users', function (Blueprint $table) {
$table->bigIncrements('id');
$table->string('provider_type')->nullable()->comment('Social Account Type');
$table->string('provider_token')->nullable()->comment('Social Account Token');
$table->string('name');
$table->string('password')->nullable();
$table->string('forgot_password')->nullable();
$table->string('email');
$table->string('phone')->nullable();
$table->boolean('is_blocked')->default(0);
$table->softDeletes();
$table->timestamps();
});
#laravel