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.4.3(1mo ago)0351MITPHPPHP ^8.2 || ^8.3 || ^8.4CI passing

Since May 8Pushed 1mo 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 1w ago

READMEChangelogDependencies (98)Versions (35)Used By (0)

[![Version](https://camo.githubusercontent.com/252d8a7116e6a2eba01418242cccfedf72cc3d39b1bb030bc2b9140576a1ca66/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f736368656e6b652d696f2f6c61726176656c2d617574682d726f757465723f7374796c653d666c6174)](https://packagist.org/packages/schenke-io/laravel-auth-router)[![Downloads](https://camo.githubusercontent.com/97db86d557e094cd0bfc1dec8faaf4388ef99384f00488d6ce2dbcbfe33eff79/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f736368656e6b652d696f2f6c61726176656c2d617574682d726f757465723f7374796c653d666c6174)](https://packagist.org/packages/schenke-io/laravel-auth-router)[![Tests](https://github.com/schenke-io/laravel-auth-router/actions/workflows/run-tests.yml/badge.svg)](https://github.com/schenke-io/laravel-auth-router/actions/workflows/run-tests.yml)[![License](https://camo.githubusercontent.com/01be06083479fe58bbe8a63f25164499c49c46f220df9db5da442be9534d1c54/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f736368656e6b652d696f2f6c61726176656c2d617574682d726f757465723f7374796c653d666c6174)](https://github.com/schenke-io/laravel-auth-router/blob/main/LICENSE.md)[![PHP](https://camo.githubusercontent.com/d50db6b38a6f6825f742cdd786a3336c8286429e996815ceb9d612b60c6d5d3d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f736368656e6b652d696f2f6c61726176656c2d617574682d726f757465723f7374796c653d666c6174)](https://packagist.org/packages/schenke-io/laravel-auth-router)

Schenke Io Laravel Auth Router
========================================================================================

[](#schenke-io-laravel-auth-router)

> Helper kit for AUTH routings in Laravel applications

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.
- **Flexible Fluent API:** Customize behavior like success/error redirects, registration permission, and session persistence with a simple, readable chain.
- **Integrated Impersonation:** Easily enable a secure "log in as user" flow for administrators with a single configuration call.
- **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)

- [Schenke Io Laravel Auth Router](#schenke-io-laravel-auth-router)
    - [Contents](#contents)
    - [Installation](#installation)
    - [Database Requirements](#database-requirements)
        - [Nameless logins](#nameless-logins)
    - [Basic Concept](#basic-concept)
    - [Login and Logout flow](#login-and-logout-flow)
    - [Name conflicts](#name-conflicts)
    - [Debugging](#debugging)
    - [Configuration](#configuration)
        - [Standard Socialite Drivers](#standard-socialite-drivers)
        - [WorkOS Drivers](#workos-drivers)
        - [Impersonation](#impersonation)
        - [Fallback for missing user names](#fallback-for-missing-user-names)
    - [Errors](#errors)
        - [Setup errors](#setup-errors)
        - [Runtime errors](#runtime-errors)
            - [Session Keys and Headers](#session-keys-and-headers)
            - [Error Context and Recommendation](#error-context-and-recommendation)
        - [Error Categories](#error-categories)
        - [Error Cases](#error-cases)
    - [Example Google login](#example-google-login)
    - [Advanced Example](#advanced-example)
    - [Route Prefixing and Naming](#route-prefixing-and-naming)
    - [Impersonation](#impersonation)
    - [Key Classes](#key-classes)
- [Providers](#providers)
    - [WorkOS Configuration](#workos-configuration)
    - [WhatsApp Configuration](#whatsapp-configuration)
        - [Email and Password Flow](#email-and-password-flow)
    - [Apple Configuration](#apple-configuration)
        - [Server-to-Server Notifications](#server-to-server-notifications)
        - [Apple Socialite Callback](#apple-socialite-callback)
    - [Custom Provider](#custom-provider)
        - [Real vs. Fake Usage](#real-vs-fake-usage)
    - [Restriction: Mixing Providers](#restriction-mixing-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)
    - [Whatsapp Provider](#whatsapp-provider)
    - [Apple Provider](#apple-provider)
    - [Custom Provider](#custom-provider)
    - [Workos Provider](#workos-provider)
    - [Logto Provider](#logto-provider)
    - [Passkey Provider](#passkey-provider)

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

[](#installation)

Install the package with composer:

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

Database Requirements
----------------------------------------------------------------------

[](#database-requirements)

Your `users` table should include a `provider_id` column to support unique identification of users across different login providers. You can add it using a migration:

```
Schema::table('users', function (Blueprint $table) {
    $table->string('provider_id')->nullable()->index()->after('email');
});
```

### Nameless logins

[](#nameless-logins)

Identity providers may legitimately return no display name (email-only Logto/WorkOS accounts, some Apple relays, passkey, WhatsApp). The package never invents a name — on user creation the name is left unset. Your `users.name` column **must be nullable or carry a DB default.** Laravel's default migration makes `name` `NOT NULL`; if you keep that, either make it nullable or configure a default-name fallback, otherwise new nameless sign-ups fail with a database constraint error.

Basic Concept
------------------------------------------------------

[](#basic-concept)

In the `routes/web.php` file you use the `Route::authRouter()` macro to define which providers you want to use and your registration policy. This package handles the configuration through `config/services.php`.

```
Route::authRouter(['google', 'microsoft'])
    ->middleware(['web', 'throttle:60,1'])
    ->success('dashboard')
    ->error('login')
    ->home('home')
    ->canAddUsers(true)
    ->rememberMe(false)
    ->useProviderId(true)
    ->prefix('auth')
    ->name('auth.')
    ->debug('stack')
    ->register();
```

MethodDefinitionExamples`success()`route after successful login'dashboard'`error()`route after login failure, should be able to display errors as feedback'error'`home()`route to a non-protected view (default: 'home')'home'`canAddUsers()`should unknown users be added or rejected (default: true)`true` or `false``rememberMe()`stores the login even when session expires (default: false)`true` or `false``useProviderId()`use the provider ID for user lookup (default: false)`true` or `false``prefix()`prefix for the URIs'auth'`name()`prefix for the route names'auth.'`middleware()`additional middleware for the routes'web' or `['web', 'throttle']``emailConfirm()`implementation of `EmailConfirmInterface` to handle email verification`$myEmailConfirm``debug()`log channel for debug information (registration and communication)'stack'`register()`**Mandatory** call to actually register the routesRoute names can be same. If the homepage can display errors `error()` and `home()` 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 (or `auth.login` if using `.name('auth.')`). It either displays the selector page, configuration errors or redirects 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)

If you have multiple authentication setups or want to avoid name conflicts, use `prefix()` and `name()`:

```
// routes/web.php
Route::authRouter('google')
    ->prefix('admin')
    ->name('admin.')
    ->success('admin.dashboard')
    ->register();
```

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

- /admin/login (named `admin.login`)
- /admin/login/google (named `admin.login.google`)
- /admin/callback/google (named `admin.callback.google`)
- /admin/logout (named `admin.logout`)

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

Debugging
----------------------------------------------

[](#debugging)

If you want to track the authentication process, use the `debug()` method with a log channel name. This will log:

- Successful route registrations
- Start of login and callback processes
- Successful authentications (with provider and email)
- Errors (with error type and details)

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

[](#configuration)

There is no special configuration file; all setup is done via `config/services.php`.

### Standard Socialite Drivers

[](#standard-socialite-drivers)

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
],
```

### WorkOS Drivers

[](#workos-drivers)

WorkOS drivers require an `api_key`, `client_id`, and `organization_id`:

```
// config/services.php
'workos_google' => [
    'api_key' => env('WORKOS_API_KEY'),
    'client_id' => env('WORKOS_CLIENT_ID'),
    'organization_id' => env('WORKOS_ORGANIZATION_ID'),
],

'whatsapp' => [
    'api_key' => env('WHATSAPP_API_KEY'),
    'approved_emails' => env('WHATSAPP_APPROVED_EMAILS'),
],

'logto' => [
    'endpoint' => env('LOGTO_ENDPOINT'),
    'app_id' => env('LOGTO_APP_ID'),
    'app_secret' => env('LOGTO_APP_SECRET'),
]
```

### Impersonation

[](#impersonation)

You can enable impersonation using the `canImpersonate()` method on the fluent builder. It accepts an optional gate name that must be passed for a user to start impersonating others.

```
Route::authRouter(['google'])
    ->canImpersonate('admin')
    ->register();
```

### Fallback for missing user names

[](#fallback-for-missing-user-names)

If a provider returns no user name, you can define a fallback strategy using `defaultName()`.

```
Route::authRouter(['google'])
    ->defaultName('email-local')
    ->register();
```

The following strategies are available:

- `'email-local'`: Uses the local part of the email address (before the `@`).
- A custom string: Uses this string as the name.
- A `Closure`: Receives a `UserData` object and must return a string. **Note:** Using a Closure will prevent Laravel's route caching.

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)

Runtime errors are stored in the session and can be handled by your application. Whenever a runtime error occurs, it is automatically logged. If no specific `logChannel` is configured in the `authRouter()` chain, it defaults to the standard `error` log with an `[AuthRouter]` prefix.

#### Session Keys and Headers

[](#session-keys-and-headers)

All session keys are defined as constants in the `SchenkeIo\LaravelAuthRouter\Auth\SessionKey` class.

ConstantSession KeyHeaderDescription`ERROR_INFO``auth-router-error-info`Localized user-friendly error message.`ERROR_MESSAGE``auth-router-error-message`Technical error message (truncated).`ERROR_TYPE``auth-router-error-type``X-Custom-Error-Type`The name of the error case (e.g. `State`).`ERROR_CATEGORY``auth-router-error-category``X-Custom-Error-Category`The category of the error.`ERROR_REFERENCE``auth-router-error-reference``X-Custom-Error-Reference`Unique 8-character reference code.#### Error Context and Recommendation

[](#error-context-and-recommendation)

To simplify error handling in your Blade views, you can use the `SchenkeIo\LaravelAuthRouter\Auth\ErrorContext` DTO. It provides a convenient way to access all error data and localized recommendations.

```
@use(SchenkeIo\LaravelAuthRouter\Auth\ErrorContext)
@php($error = ErrorContext::fromSession())

@if($error)

        {{ $error->category->name }}
        {{ $error->info }}

        @if($error->message)
            {{ $error->message }}
        @endif

            What to do: {{ $error->recommendation() }}

            Error Code: {{ $error->type }} | Reference: {{ $error->reference }}

@endif

```

### Error Categories

[](#error-categories)

Each error belongs to an `ErrorCategory` enum:

- `Configuration`: Issues with your `config/services.php` or environment.
- `Network`: Connectivity problems with the provider.
- `Account`: Issues related to the user's account or registration policy.
- `Session`: Expired sessions, CSRF (State) mismatches, or invalid requests.
- `Provider`: Errors returned directly by the third-party login provider.
- `Unknown`: Unexpected internal errors.

### Error Cases

[](#error-cases)

The following error names are used in the `X-Custom-Error-Type` header and define the error's source:

Error NameDescription`UnknownService`The requested login provider is unknown.`ServiceNotSet`The provider service is not defined in config.`ConfigNotSet`A specific config value (e.g., client\_id) is missing.`UnableToAddNewUsers`New user registration is disabled in the macro call.`EmailMissing`The provider did not return an email address.`InvalidEmail`The returned email address is invalid.`LocalAuth`Local authentication process failed.`RemoteAuth`The third-party provider returned an error.`State`OAuth state mismatch (potential CSRF).`Network`A network error occurred during the callback.`InvalidRequest`The login or callback request was invalid.`MixedProviders`Mixing WorkOS and non-WorkOS providers is not allowed.`InvalidCredentials`The provided credentials (email/password) are incorrect.`ClosureNotCacheable`Using a Closure in `defaultName()` prevents route caching.`EmailConfirmNotCacheable`The email confirmation handler must be cacheable.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')
    ->success('dashboard')
    ->error('error')
    ->home('home')
    ->register();
```

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 in `config/services.php`.
3. Add the routes:

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

Route Prefixing and Naming
--------------------------------------------------------------------------------

[](#route-prefixing-and-naming)

To avoid route name conflicts or to group authentication routes under a specific path, you can use the `prefix()` and `name()` methods:

```
// routes/web.php
Route::authRouter('google')
    ->prefix('auth')
    ->name('auth.')
    ->success('dashboard')
    ->register();
```

This generates routes like `/auth/login`, `/auth/callback/google`, and route names like `auth.login`, `auth.login.google`.

Impersonation
------------------------------------------------------

[](#impersonation-1)

To enable the impersonation feature, use the `canImpersonate()` method. This will register routes to start and stop impersonating other users, protected by an optional gate:

```
// routes/web.php
Route::authRouter('google')
    ->canImpersonate('admin-gate')
    ->register();
```

This registers:

- `impersonate.start`: `GET /impersonate/start/{user}`
- `impersonate.stop`: `POST /impersonate/stop`

Key Classes
--------------------------------------------------

[](#key-classes)

ClassSummary`Service`All supported authentication services.`UserData`Data object for user information, mapping different provider user formats.Providers
==============================================

[](#providers)

The following providers are supported:

- `amazon`
- `auth0`
- `facebook`
- `google`
- `linkedin`
- `microsoft`
- `paypal`
- `stripe`
- `apple`
- `whatsapp`
- `custom`
- `workos_apple`
- `workos_email`
- `workos_google`
- `workos_linkedin`
- `logto`
- `passkey`

WorkOS Configuration
--------------------------------------------------------------------

[](#workos-configuration)

To use WorkOS providers, you must set the following environment variables:

- `WORKOS_API_KEY` (stored in `services.workos.api_key`)
- `WORKOS_CLIENT_ID` (stored in `services.workos.client_id`)
- `WORKOS_ORGANIZATION_ID` (stored in `services.workos.organization_id`)

WhatsApp Configuration
------------------------------------------------------------------------

[](#whatsapp-configuration)

To use WhatsApp login, you must set the following environment variables:

- `WHATSAPP_API_KEY` (stored in `services.whatsapp.api_key`)
- `WHATSAPP_APPROVED_EMAILS` (stored in `services.whatsapp.approved_emails`) - a comma-separated list of approved emails.

WhatsApp login requires an approved email to be provided first. The flow includes a button to start the login and a waiting page for the user to confirm via their WhatsApp device.

### Email and Password Flow

[](#email-and-password-flow)

The `workos_email` provider supports both magic link flows (GET) and direct email/password authentication (POST). The login view includes fields for both, allowing users to choose their preferred method.

Apple Configuration
------------------------------------------------------------------

[](#apple-configuration)

To use Apple Sign-In, you must set the following environment variables:

- `APPLE_CLIENT_ID` (your Service ID)
- `APPLE_TEAM_ID` (your Apple Team ID)
- `APPLE_KEY_ID` (your Apple Key ID)
- `APPLE_PRIVATE_KEY` (the content of your `.p8` key file)

The package automatically handles dynamic client secret generation required by Apple.

### Server-to-Server Notifications

[](#server-to-server-notifications)

Apple can send notifications when a user disables email relay or revokes consent. This package provides a webhook handler for these events.

**Webhook URL:** `https://your-app.com/auth/apple/webhook` (assuming default prefix)

**Configuration:**

1. In the Apple Developer portal, set the "Server-to-Server Notification Endpoint" to the URL above.
2. Ensure the route is excluded from CSRF protection in your application.

In Laravel 11+, you can do this in `bootstrap/app.php`:

```
->withMiddleware(function (Middleware $middleware) {
    $middleware->validateCsrfTokens(except: [
        'auth/apple/webhook',
    ]);
})
```

The handler will:

- Mark `email_verified_at` as `null` if the user disables email relay.

### Apple Socialite Callback

[](#apple-socialite-callback)

Apple Sign-In is unique because it only provides the user's name and email on the **first** successful authentication ("One-Shot"). Subsequent logins only provide the unique Apple ID (`sub` claim).

This package handles this by:

1. **Returning User:** Checking for an existing user by their email.
2. **New User (One-Shot):** Creating a new user and capturing the name and email provided by Apple on their first login.

Custom Provider
----------------------------------------------------------

[](#custom-provider)

The `custom` provider is a flexible authentication option that can be fully configured via your `config/services.php` and `.env` file. It leverages Laravel Socialite to provide a "free programmable" login flow.

### Real vs. Fake Usage

[](#real-vs-fake-usage)

In your `.env` file, you can define the service keys for the `custom` provider.

**Real Provider:**To connect to a real OAuth service, provide the actual client credentials:

```
CUSTOM_CLIENT_ID=your-real-client-id
CUSTOM_CLIENT_SECRET=your-real-client-secret
CUSTOM_REDIRECT_URI=https://your-app.com/auth/custom/callback
```

**Fake Provider (Mocking):**For local development or CI, you can use a mock driver or a "fake" configuration. Since the `custom` provider uses standard Socialite logic, you can easily mock it in your tests:

```
Socialite::fake();
```

This allows you to test the entire login flow without ever making a real network request.

Restriction: Mixing Providers
-------------------------------------------------------------------------------------

[](#restriction-mixing-providers)

A collection of login providers passed to `Route::authRouter` must **NOT** contain a mix of WorkOS and non-WorkOS providers. If any WorkOS provider is present, all other providers in that same set must also be WorkOS providers.

IDDetailLinkamazonSocial login with Amazongooglesocial login with GooglelinkedinSocial login with LinkedInmicrosoftSocial login with MicrosoftpaypalSocial login with PayPalauth0social login with Auth0facebookSocial login with FacebookstripeSocial login with StripewhatsappWhatsApp login provider implementation.??appleSocial login with Apple.customA free programmable login provider.??workosSocial login with WorkOSlogtoClass LogtoProvider??passkeyPasskey login provider implementation.??Amazon 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

Whatsapp Provider
--------------------------------------------------------------

[](#whatsapp-provider)

First go to ?? This provider handles WhatsApp-specific authentication logic.

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

```
WHATSAPP_API_KEY=...
WHATSAPP_APPROVED_EMAILS=...
```

Edit the `config/services.php` file:

```
    'whatsapp' => [
        'api_key' => env('WHATSAPP_API_KEY'),
        'approved_emails' => env('WHATSAPP_APPROVED_EMAILS'),
    ],
```

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

Apple Provider
--------------------------------------------------------

[](#apple-provider)

First go to This provider uses dynamic client secret generation via AppleTokenGenerator. It also handles Server-to-Server notifications.

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

```
APPLE_CLIENT_ID=...
APPLE_TEAM_ID=...
APPLE_KEY_ID=...
APPLE_PRIVATE_KEY=...
```

Edit the `config/services.php` file:

```
    'apple' => [
        'client_id' => env('APPLE_CLIENT_ID'),
        'team_id' => env('APPLE_TEAM_ID'),
        'key_id' => env('APPLE_KEY_ID'),
        'private_key' => env('APPLE_PRIVATE_KEY'),
    ],
```

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

Custom Provider
----------------------------------------------------------

[](#custom-provider-1)

First go to ?? This provider allows for flexible configuration using environment variables. It utilizes Laravel Socialite to handle the authentication flow.

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

```
CUSTOM_CLIENT_ID=...
CUSTOM_CLIENT_SECRET=...
```

Edit the `config/services.php` file:

```
    'custom' => [
        'client_id' => env('CUSTOM_CLIENT_ID'),
        'client_secret' => env('CUSTOM_CLIENT_SECRET'),
    ],
```

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

Workos Provider
----------------------------------------------------------

[](#workos-provider)

First go to

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

```
WORKOS_CLIENT_ID=...
WORKOS_API_KEY=...
WORKOS_CLIENT_SECRET=...
```

Edit the `config/services.php` file:

```
    'workos' => [
        'client_id' => env('WORKOS_CLIENT_ID'),
        'api_key' => env('WORKOS_API_KEY'),
        'client_secret' => env('WORKOS_CLIENT_SECRET'),
    ],
```

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

Logto Provider
--------------------------------------------------------

[](#logto-provider)

First go to ?? Handles authentication via Logto SDK. Main Responsibilities:

- Login: Redirects users to Logto for authentication.
- Callback: Processes the authentication response from Logto.
- Logout: Handles session termination and redirection. Usage Example:

```
Route::authRouter('logto')->register();
```

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

```
LOGTO_ENDPOINT=...
LOGTO_APP_ID=...
LOGTO_APP_SECRET=...
```

Edit the `config/services.php` file:

```
    'logto' => [
        'endpoint' => env('LOGTO_ENDPOINT'),
        'app_id' => env('LOGTO_APP_ID'),
        'app_secret' => env('LOGTO_APP_SECRET'),
    ],
```

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

Passkey Provider
------------------------------------------------------------

[](#passkey-provider)

First go to ??

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

```
```

Edit the `config/services.php` file:

```
    'passkey' => [
    ],
```

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

---

Markdown file generated by [schenke-io/packaging-tools](https://github.com/schenke-io/packaging-tools)

###  Health Score

45

—

FairBetter than 91% of packages

Maintenance90

Actively maintained with recent releases

Popularity14

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity57

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 ~12 days

Recently: every ~5 days

Total

34

Last Release

52d ago

PHP version history (2 changes)v0.1.0PHP ^8.3

v0.2.6PHP ^8.2 || ^8.3 || ^8.4

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/111449674?v=4)[Kay-Uwe Schenke](/maintainers/schenke-io)[@schenke-io](https://github.com/schenke-io)

---

Top Contributors

[![schenke-io](https://avatars.githubusercontent.com/u/111449674?v=4)](https://github.com/schenke-io "schenke-io (55 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

[psalm/plugin-laravel

Psalm plugin for Laravel

3345.4M354](/packages/psalm-plugin-laravel)[laravel/mcp

Rapidly build MCP servers for your Laravel applications.

79227.1M238](/packages/laravel-mcp)[api-platform/laravel

API Platform support for Laravel

58190.1k21](/packages/api-platform-laravel)[fleetbase/core-api

Core Framework and Resources for Fleetbase API

1239.7k25](/packages/fleetbase-core-api)[defstudio/telegraph

A laravel facade to interact with Telegram Bots

818355.4k3](/packages/defstudio-telegraph)[simplestats-io/laravel-client

Server-side analytics for Laravel that follows the full funnel from visit to registration to payment, attributed to the channel that drove it. Revenue, MRR, churn and ad-spend profit (ROAS/CAC) per channel. GDPR compliant, ad-blocker proof.

5226.7k](/packages/simplestats-io-laravel-client)

PHPackages © 2026

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