Login with multiple emails and Google Login in Laravel9 | Vue & DDD & Hexagonal Architecture & Laravel Sail
This project extends Laravel authentication to allow login with multiple emails and support Google login
The application implements the following features and technologies:
- Google login functionality with Laravel Socialite
- Extension of the EloquentUserProvider class to support login with multiple emails
- External API with one endpoint. Protected with API tokens using Laravel Sanctum
- Internal API protected with Laravel session authentication
- In the frontend there are developed Vue.JS components that consume the internal API
- The API features are decoupled from the framework with Hexagonal Architecture and DDD concepts
- Project built on a Docker development environment through a Laravel Sail interaction. More info
- Support for users universally unique identifiers (uuid)
This project passes level 9 of phpstan
Laravel version: 9.1.0
- PHP ^8.0.2
- Install Docker
- Install Composer
- Clone this project:
git clone https://github.com/adrianRoldan/extended_laravel_login.git
- Move to the project folder:
extended_laravel_login
- Run:
composer install
- Start your docker
- Execute
./vendor/bin/sail up
to up containers - Run migrations and seeders
sail artisan migrate --seed
- Compile frontend with
sail npm run dev
- Configure your .env file with your Google keys to test the Google Login. Info to create Google Api Keys
GOOGLE_ID=
GOOGLE_SECRET=
The application runs in the port 80: http://localhost
To manage mysql database you can use phpmyadmin: http://localhost:8080
You have a default user available to test:
- emails: test@test.com or alias@example.com
- pass: password
The following endpoint returns the email domains most used by users. With the optional parameter we can limit the number of returned domains.
When making requests using API tokens, the token should be included in the Authorization header as a Bearer token.
You can obtain the API token in the application user profile (http://localhost/users/{user_id}).
The Api.postman_collection.json file has the collection of API requests available with the input data to import into postman.
GET
/api/domains/used
Input parameters:
max={max_number_of_domains?}
- Run next command to execute tests:
./vendor/bin/sail test