PHPackages                             emmanuel-saleem/social-auth - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. emmanuel-saleem/social-auth

ActiveLibrary

emmanuel-saleem/social-auth
===========================

Laravel social authentication package with Google, Microsoft and more OAuth providers using Socialite

1.0.0(6mo ago)034MITPHPPHP ^8.0|^8.1|^8.2|^8.3

Since Oct 24Pushed 6mo agoCompare

[ Source](https://github.com/es-77/social-auth)[ Packagist](https://packagist.org/packages/emmanuel-saleem/social-auth)[ RSS](/packages/emmanuel-saleem-social-auth/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (4)Versions (2)Used By (0)

Emmanuel Saleem Social Auth Package
===================================

[](#emmanuel-saleem-social-auth-package)

A comprehensive Laravel package for OAuth social authentication with Google and Microsoft, supporting both traditional web applications and modern SPA/API-based frontends.

[![License: MIT](https://camo.githubusercontent.com/fdf2982b9f5d7489dcf44570e714e3a15fce6253e0cc6b5aa61a075aac2ff71b/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d79656c6c6f772e737667)](https://opensource.org/licenses/MIT)[![Laravel](https://camo.githubusercontent.com/3b9579f2aaaef79df70a9e757d4eefc54ad599f66bbdf2263fe5b9471a4d3fc9/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c61726176656c2d3825323025374325323039253230253743253230313025323025374325323031312d7265642e737667)](https://laravel.com)[![PHP](https://camo.githubusercontent.com/d4b5fa4adf514144779a7864904c5e15236c0e798635240c7f6ce9a455657b80/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d382e302532422d626c75652e737667)](https://php.net)[![Version](https://camo.githubusercontent.com/7d41ed62104e837ba0b4de09f2dd55e9b4de4d45032058d4a089fe80c71e47a8/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f56657273696f6e2d312e302e302d677265656e2e737667)](https://packagist.org/packages/emmanuel-saleem/social-auth)

📚 Table of Contents
-------------------

[](#-table-of-contents)

- [Features](#-features)
- [Requirements](#-requirements)
- [Installation](#-installation)
- [Quick Start - Add Login to Your App](#-quick-start---add-login-to-your-app) ⭐
- [Configuration](#%EF%B8%8F-configuration)
- [Usage (Web &amp; API)](#-usage)
- [Customization](#-customization)
- [Troubleshooting](#-troubleshooting)
- [Documentation](#-documentation)

---

✨ Features
----------

[](#-features)

- 🔐 **Google OAuth** authentication (Web &amp; API)
- 🔐 **Microsoft OAuth** authentication (Web &amp; API)
- 🌐 **Dual Mode Support**: Traditional web and SPA/API applications
- 🎨 **Pre-built Login UI** with beautiful, modern design
- 📱 **Mobile-friendly** responsive design
- 🔄 **Auto-migration** for adding social auth fields to users table
- 🛡️ **Flexible Authentication**: Support for both **Laravel Sanctum** and **Laravel Passport**
- 🔑 **Token Management**: Automatic token generation with expiration support
- 📦 **Easy Installation** with Laravel auto-discovery
- ⚙️ **Highly Configurable**: routes, middleware, redirects, button labels, and more
- 🚀 **Production Ready** with comprehensive error handling
- 📊 **Standardized API Responses** with consistent JSON format

---

📋 Requirements
--------------

[](#-requirements)

- PHP 8.0 or higher
- Laravel 8.x, 9.x, 10.x or 11.x
- Laravel Socialite 4.x (for Laravel 8) or 5.x (for Laravel 9+)
- Laravel Sanctum (for API authentication - default) **OR** Laravel Passport (optional)

---

📦 Installation
--------------

[](#-installation)

### Step 1: Install via Composer

[](#step-1-install-via-composer)

**For Development (Current Available Version):**

```
composer require emmanuel-saleem/social-auth:dev-master --no-cache
```

**Alternative Installation Methods:**

```
# Install from GitHub directly
composer require emmanuel-saleem/social-auth:dev-master --prefer-source

# Add GitHub repository to composer.json (if needed)
# Add this to your composer.json repositories section:
# {
#     "type": "vcs",
#     "url": "https://github.com/your-username/emmanuel-saleem-social-auth"
# }
```

> 📝 **Note:** The package is currently in development. Stable versions will be available after publishing to Packagist. Use `dev-master` for now.

### Step 2: Install Authentication System (for API routes)

[](#step-2-install-authentication-system-for-api-routes)

**Option A: Laravel Sanctum (Recommended - Default)**

```
composer require laravel/sanctum
php artisan vendor:publish --provider="Laravel\Sanctum\SanctumServiceProvider"
php artisan migrate
```

**Option B: Laravel Passport (For OAuth2 Server)**

```
composer require laravel/passport
php artisan migrate
php artisan passport:install
```

> 📖 **See [PASSPORT\_SETUP.md](./PASSPORT_SETUP.md) for detailed Passport configuration**

### Step 3: Add HasApiTokens to User Model

[](#step-3-add-hasapitokens-to-user-model)

**For Sanctum (Default):**

```
