#laravelsocialitefacebook
Explore tagged Tumblr posts
Text
Laravel 9 Socialite Login with Facebook Tutorial
How to use Facebook to log into a Laravel application. If you have the same query, keep reading; in this article, we'll learn how to use the Socialite package in Laravel to log in with a Facebook social media account. The Laravel Socialite package allows you to create a strong, expressive OAuth authentication interface with a variety of social media networks, including Facebook, Twitter, Google, LinkedIn, GitHub, GitLab, and Bitbucket. Its user-centric boilerplate social authentication technique saves you time. Logging in with social accounts is a simple process that improves the user experience; nowadays, everyone understands that a better user experience is critical to the success of any digital product. The user's anticipation to access and register within the application is pushed ahead by social login. As a result, we're adding a simple Facebook login capability to the Laravel application. For this lesson, we'll need authentication user interface templates, and we'll be utilizing Laravel Jetstream to automate the process. Laravel Jetstream is a well created authentication scaffolding built using Tailwind CSS; you can also use Livewire or Inertia scaffolding to create auth templates. It supports Laravel by providing login, registration, email verification, two-factor authentication, session management, and API support. Incredible, isn’t it? Let’s start integrating Login with Facebook in the Laravel application.
1. Set Up Laravel Environment
composer create-project laravel/laravel --prefer-dist laravel-socialite-login-facebook-example Take a look inside the project: cd laravel-socialite-login-facebook-example
2. Add Database Details
Enter the database name, user name, and password for your database in the.env file. DB_CONNECTION=mysql DB_HOST=127.0.0.1 DB_PORT=3306 DB_DATABASE=database_name DB_USERNAME=root DB_PASSWORD=
3. Setting up Jetstream in Laravel
Jetstream may be installed with the following command: composer require laravel/jetstream Execute command to generate authentication templates such as login, register and email verification. php artisan jetstream:install livewire Next, run below command. npm install Using the node package manager, run dev packages. npm run dev To migrate authentication properties, run the command. php artisan migrate
4. Install Socialite Package in Laravel
With the following line, you can install the socialite package in Laravel. composer require laravel/socialite Register the socialite plugin in the providers and aliases array in config/app.php. .... .... 'providers' => , 'aliases' => , .... ....
5. Add Facebook ID in Users Table
We need to keep adding the Facebook id to the users table. php artisan make:migration add_fb_id_column_in_users_table --table=users Go to the newly generated file. migrations/timestamp_add_fb_id_column_in_users_table.php file, add the fb_id column value. Read the full article
0 notes