Skip to content

This project extends Laravel authentication to allow login with multiple emails and support Google login

Notifications You must be signed in to change notification settings

adrianRoldan/extended_laravel_login

Repository files navigation

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

Environment Setup

Laravel version: 9.1.0

PHP requeriments

  1. PHP ^8.0.2

Needed tools

  1. Install Docker
  2. Install Composer
  3. Clone this project: git clone https://github.com/adrianRoldan/extended_laravel_login.git
  4. Move to the project folder: extended_laravel_login

Up Environment

  1. Run: composer install
  2. Start your docker
  3. Execute ./vendor/bin/sail up to up containers
  4. Run migrations and seeders sail artisan migrate --seed
  5. Compile frontend with sail npm run dev
  6. Configure your .env file with your Google keys to test the Google Login. Info to create Google Api Keys
GOOGLE_ID=
GOOGLE_SECRET=

Application execution

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:


API Endpoint

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.

Endpoint to get email domains most used:

GET /api/domains/used

Input parameters:

max={max_number_of_domains?}

Tests execution

  1. Run next command to execute tests: ./vendor/bin/sail test

About

This project extends Laravel authentication to allow login with multiple emails and support Google login

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published