PHPackages                             schenke-io/laravel-auth-router - 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. [Authentication &amp; Authorization](/categories/authentication)
4. /
5. schenke-io/laravel-auth-router

ActiveLibrary[Authentication &amp; Authorization](/categories/authentication)

schenke-io/laravel-auth-router
==============================

Helper kit for AUTH routings in Laravel applications

v0.2.5(9mo ago)053MITPHPPHP ^8.3CI passing

Since May 8Pushed 9mo ago1 watchersCompare

[ Source](https://github.com/schenke-io/laravel-auth-router)[ Packagist](https://packagist.org/packages/schenke-io/laravel-auth-router)[ RSS](/packages/schenke-io-laravel-auth-router/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (19)Versions (9)Used By (0)

Laravel Auth Router
===================

[](#laravel-auth-router)

Social Login made easy

[![Test](https://camo.githubusercontent.com/c45d37a92dfb37eab7b23a2f20fb050bf6c285156b3c3dc2d6726948e669b69d/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f736368656e6b652d696f2f6c61726176656c2d617574682d726f757465722f72756e2d74657374732e796d6c3f7374796c653d666c6174266272616e63683d6d61696e266c6162656c3d7465737473)](https://github.com/schenke-io/laravel-auth-router/actions/workflows/%3Arun-tests.yml%3Amain)[![Latest Version](https://camo.githubusercontent.com/252d8a7116e6a2eba01418242cccfedf72cc3d39b1bb030bc2b9140576a1ca66/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f736368656e6b652d696f2f6c61726176656c2d617574682d726f757465723f7374796c653d666c6174)](https://packagist.org/packages/schenke-io/laravel-auth-router)[![Total Downloads](https://camo.githubusercontent.com/18838bdb54823a1127fa699b940c057458cc31980894e2a556df127110d4c0a9/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f736368656e6b652d696f2f6c61726176656c2d617574682d726f757465722e7376673f7374796c653d666c6174)](https://packagist.org/packages/schenke-io/laravel-auth-router)![coverage](.github/coverage.svg)![phpstan](.github/phpstan.svg)

Laravel Auth Router streamlines adding multiple social logins to your Laravel app, saving significant developer effort. Forget complex setups; this package leverages Laravel Socialite to offer a vastly simplified experience.

- **One-Liner Route Setup:** Instead of extensive controller code and numerous route definitions for each provider, a single line in your routes file can manage login, callback, and logout.
- **Pre-Built Provider Chooser:** Get an immediate, customizable page on your domain for users to select their login method – no manual UI building required.
- **Rapid Configuration:** Minimal setup is needed due to a unified route helper and familiar service configuration.
- **Developer Conveniences:** Includes multi-language support (DE/EN), dark mode for the chooser, and session-based error messages for easy integration into your Blade views.

It automatically handles routing, offers flexible customization for redirects and user registration, and prevents route conflicts, letting you focus on core features instead of auth boilerplate.

Contents
--------

[](#contents)

- [Laravel Auth Router](#laravel-auth-router)
    - [Contents](#contents)
    - [Installation](#installation)
    - [Basic concept](#basic-concept)
    - [Login and Logout flow](#login-and-logout-flow)
    - [Name conflicts](#name-conflicts)
    - [Configuration](#configuration)
    - [Errors](#errors)
        - [Setup errors](#setup-errors)
        - [Runtime errors](#runtime-errors)
    - [Example Google login](#example-google-login)
    - [Advanced Example](#advanced-example)
- [Providers](#providers)
    - [Amazon Provider](#amazon-provider)
    - [Google Provider](#google-provider)
    - [Linkedin Provider](#linkedin-provider)
    - [Microsoft Provider](#microsoft-provider)
    - [Paypal Provider](#paypal-provider)
    - [Auth0 Provider](#auth0-provider)
    - [Facebook Provider](#facebook-provider)
    - [Stripe Provider](#stripe-provider)

Installation
------------

[](#installation)

Install the package with composer:

```
  composer require schenke-io/laravel-auth-router
```

Basic concept
-------------

[](#basic-concept)

This package includes services and has to be configured in `config/services.php` only.

In the `routes/web.php` file you add the Route helper `authRouter` to define which providers you want to use and your registration policy.

```
Route::authRouter(/* provider/s */, $routeSuccess, $routeError, $routeHome, $canAddUsers);
```

ParameterDefinitionExamplesprovidername of the social login providers, single string or array of strings'google' *or* \['google','microsoft'\]routeSuccessroute after successful login'dashboard'routeErrorroute after login failure, should be able to display errors as feedback'error'routeHomeroute to a non protected view'home'canAddUsersshould unknown users be added or rejected`true` or `false`remeberMestores the login even when session expirers`true` or `false`Route names can be same. If the homepage can display errors `routeError` and `routeHome` could be the same. When the service configuration is not complete not all routes will be created.

Login and Logout flow
---------------------

[](#login-and-logout-flow)

In the app just link to the `login` route. It either displays the selector page, configuration errors or redirect to a single login provider.

For logout just do an empty POST to the `logout` route. Only authenticated users can use the logout.

Name conflicts
--------------

[](#name-conflicts)

This line:

```
// routes/web.php
Route::authRouter('google','dashboard','error','home',true);
```

registers the following routes when the configuration is free of errors:

- /login
- /login/google
- /callback/google
- /logout

and expects the 3 named routes to be defined: `dashboard`, `error` and `home`.

If this conflicts with other existing routes just prefix it with something:

```
// routes/web.php
Route::prefix('any')->name('any.')->group(function () {
    Route::authRouter('google','dashboard','error','home',true);
});
```

Just use `php artisan route:list` to see which names and routes have been added.

Configuration
-------------

[](#configuration)

There is no special configuration file, all setup is done over `config/services.php`.

To make a standard Socialite driver stateless, add a `stateless` key in its `config/services.php` section:

```
// config/services.php
'google' => [
    'client_id' => env('GOOGLE_CLIENT_ID'),
    'client_secret' => env('GOOGLE_CLIENT_SECRET'),
    'stateless' => true
]
```

Errors
------

[](#errors)

The package handles two types of errors differently:

1. setup errors the developer can handle
2. runtime errors which influence the user experience

### Setup errors

[](#setup-errors)

The setup errors are shown in the `/login` selector page. If you have any errors with your setup, you can fix them in `config/services.php`. Its mainly missing keys, or missing provider names in `config/services.php`.

### Runtime errors

[](#runtime-errors)

The runtime errors are stored in a session and can be handled by the app.

keyvaluelanguageauthRouterErrorInfouser message of the errorlocalisedauthRouterErrorMessageexception text of the provider/codeenglish mainlyThe error page could look like:

```

    {{session('authRouterErrorInfo')}}

    {{session('authRouterErrorMessage')}}

```

Example Google login
--------------------

[](#example-google-login)

1. In the `.env` file you have the credentials:

```
GOOGLE_CLIENT_ID=24242343242
GOOGLE_CLIENT_SECRET=3843430984
```

2. In `config/services.php` you define the service:

```
// config/services.php
'google' => [
    'client_id' => env('GOOGLE_CLIENT_ID'),
    'client_secret' => env('GOOGLE_CLIENT_SECRET')
]
```

3. in the `routes/web.php` you define the route:

```
// routes/web.php
Route::authRouter('google','dashboard','error','home',true);
```

Advanced Example
----------------

[](#advanced-example)

If you want a selection of logins you basically just do:

1. fill the secret data into .env
2. register the services
3. add the route

```
// routes/web.php
Route::authRouter(['google','paypal','microsoft'],'dashboard','error','home',true);
```

Providers
=========

[](#providers)

The following providers can be easily setup:

IDDetailLinkamazonSocial login with Amazongooglesocial login with GooglelinkedinSocial login with LinkedInmicrosoftSocial login with MicrosoftpaypalSocial login with PayPalauth0social login with Auth0facebookSocial login with FacebookstripeSocial login with StripeAmazon Provider
---------------

[](#amazon-provider)

First go to Go to Developer Portal, create a Developer Account, create a Security Profile under "Login with Amazon", find Client ID and Secret in "Web Settings."

Edit the `.env` file in your Laravel project and add the credentials:

```
AMAZON_CLIENT_ID=...
AMAZON_CLIENT_SECRET=...
```

Edit the config/services.php file:

```
    'amazon' => [
        'client_id' => env('AMAZON_CLIENT_ID'),
        'client_secret' => env('AMAZON_CLIENT_SECRET'),
    ],
```

You do not need to configure the callback URL, it will be automatically added

Google Provider
---------------

[](#google-provider)

First go to Go to Google Cloud Console, create a Project, configure OAuth Consent Screen, create OAuth client ID, find Client ID and Secret under Credentials.

Edit the `.env` file in your Laravel project and add the credentials:

```
GOOGLE_CLIENT_ID=...
GOOGLE_CLIENT_SECRET=...
```

Edit the config/services.php file:

```
    'google' => [
        'client_id' => env('GOOGLE_CLIENT_ID'),
        'client_secret' => env('GOOGLE_CLIENT_SECRET'),
    ],
```

You do not need to configure the callback URL, it will be automatically added

Linkedin Provider
-----------------

[](#linkedin-provider)

First go to Go to Developer Portal, sign in, navigate to "My Apps," create an Application, find Client ID and Secret under "Authentication Keys" in "Authentication" settings.

Edit the `.env` file in your Laravel project and add the credentials:

```
LINKEDIN_CLIENT_ID=...
LINKEDIN_CLIENT_SECRET=...
```

Edit the config/services.php file:

```
    'linkedin' => [
        'client_id' => env('LINKEDIN_CLIENT_ID'),
        'client_secret' => env('LINKEDIN_CLIENT_SECRET'),
    ],
```

You do not need to configure the callback URL, it will be automatically added

Microsoft Provider
------------------

[](#microsoft-provider)

First go to Go to Azure Portal, navigate to Azure Active Directory (or Entra ID), select "App registrations," register a new application, find Application (client) ID on "Overview," generate Client Secret under "Certificates &amp; secrets."

Edit the `.env` file in your Laravel project and add the credentials:

```
MICROSOFT_CLIENT_ID=...
MICROSOFT_CLIENT_SECRET=...
```

Edit the config/services.php file:

```
    'microsoft' => [
        'client_id' => env('MICROSOFT_CLIENT_ID'),
        'client_secret' => env('MICROSOFT_CLIENT_SECRET'),
    ],
```

You do not need to configure the callback URL, it will be automatically added

Paypal Provider
---------------

[](#paypal-provider)

First go to Go to Developer Portal, log in with business account, navigate to "Apps &amp; Credentials," choose Sandbox or Live, create an App, find Client ID and Secret on the app details page.

Edit the `.env` file in your Laravel project and add the credentials:

```
PAYPAL_CLIENT_ID=...
PAYPAL_CLIENT_SECRET=...
```

Edit the config/services.php file:

```
    'paypal' => [
        'client_id' => env('PAYPAL_CLIENT_ID'),
        'client_secret' => env('PAYPAL_CLIENT_SECRET'),
    ],
```

You do not need to configure the callback URL, it will be automatically added

Auth0 Provider
--------------

[](#auth0-provider)

First go to Go to Auth0 Dashboard, navigate to "Applications," create a new Application, find Client ID and Secret on the "Settings" tab under "Basic Information."

Edit the `.env` file in your Laravel project and add the credentials:

```
AUTH0_CLIENT_ID=...
AUTH0_CLIENT_SECRET=...
AUTH0_DOMAIN=...
AUTH0_COOKIE_SECRET=...
```

Edit the config/services.php file:

```
    'auth0' => [
        'client_id' => env('AUTH0_CLIENT_ID'),
        'client_secret' => env('AUTH0_CLIENT_SECRET'),
        'domain' => env('AUTH0_DOMAIN'),
        'cookie_secret' => env('AUTH0_COOKIE_SECRET'),
    ],
```

You do not need to configure the callback URL, it will be automatically added

Facebook Provider
-----------------

[](#facebook-provider)

First go to Go to Meta for Developers, log in, navigate to "My Apps," create an App, find App ID on the dashboard or under "Settings" -&gt; "Basic," find App Secret under "Settings" -&gt; "Basic" (click "Show").

Edit the `.env` file in your Laravel project and add the credentials:

```
FACEBOOK_CLIENT_ID=...
FACEBOOK_CLIENT_SECRET=...
```

Edit the config/services.php file:

```
    'facebook' => [
        'client_id' => env('FACEBOOK_CLIENT_ID'),
        'client_secret' => env('FACEBOOK_CLIENT_SECRET'),
    ],
```

You do not need to configure the callback URL, it will be automatically added

Stripe Provider
---------------

[](#stripe-provider)

First go to Go to Stripe Dashboard, navigate to "Connect" -&gt; "Settings" -&gt; "OAuth settings" to find Client ID, navigate to "Developers" -&gt; "API keys" to find Secret API Key (acts as client secret).

Edit the `.env` file in your Laravel project and add the credentials:

```
STRIPE_CLIENT_ID=...
STRIPE_CLIENT_SECRET=...
```

Edit the config/services.php file:

```
    'stripe' => [
        'client_id' => env('STRIPE_CLIENT_ID'),
        'client_secret' => env('STRIPE_CLIENT_SECRET'),
    ],
```

You do not need to configure the callback URL, it will be automatically added

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance56

Moderate activity, may be stable

Popularity8

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity47

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~11 days

Recently: every ~19 days

Total

8

Last Release

292d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/cf5dcac54b57dafc55c594db6ba9cb3a9a27b808f77e5cc3cda6071f56f5ad9e?d=identicon)[schenke-io](/maintainers/schenke-io)

---

Top Contributors

[![schenke-io](https://avatars.githubusercontent.com/u/111449674?v=4)](https://github.com/schenke-io "schenke-io (19 commits)")

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/schenke-io-laravel-auth-router/health.svg)

```
[![Health](https://phpackages.com/badges/schenke-io-laravel-auth-router/health.svg)](https://phpackages.com/packages/schenke-io-laravel-auth-router)
```

###  Alternatives

[spatie/laravel-honeypot

Preventing spam submitted through forms

1.6k6.0M60](/packages/spatie-laravel-honeypot)[laravel/mcp

Rapidly build MCP servers for your Laravel applications.

71510.9M66](/packages/laravel-mcp)[bezhansalleh/filament-shield

Filament support for `spatie/laravel-permission`.

2.8k2.9M88](/packages/bezhansalleh-filament-shield)[roots/acorn

Framework for Roots WordPress projects built with Laravel components.

9682.1M97](/packages/roots-acorn)[illuminate/auth

The Illuminate Auth package.

9327.3M1.0k](/packages/illuminate-auth)[galahad/laravel-addressing

Laravel package providing addressing functionality

70316.6k](/packages/galahad-laravel-addressing)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
