PHPackages                             happyr/auth0-bundle - 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. happyr/auth0-bundle

ActiveSymfony-bundle[Authentication &amp; Authorization](/categories/authentication)

happyr/auth0-bundle
===================

Symfony integration with auth0

0.8.1(4y ago)1519.8k↓100%7[4 issues](https://github.com/Happyr/auth0-bundle/issues)MITPHPPHP &gt;=7.4

Since Jun 5Pushed 4y ago1 watchersCompare

[ Source](https://github.com/Happyr/auth0-bundle)[ Packagist](https://packagist.org/packages/happyr/auth0-bundle)[ GitHub Sponsors](https://github.com/Nyholm)[ RSS](/packages/happyr-auth0-bundle/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (13)Versions (19)Used By (0)

Auth0 integration with Symfony
==============================

[](#auth0-integration-with-symfony)

[![Latest Version](https://camo.githubusercontent.com/0f0de0115063e4d866190d264eb0a1ee4d61cc6e197865f8291b1a9c512f0be9/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652f4861707079722f61757468302d62756e646c652e7376673f7374796c653d666c61742d737175617265)](https://github.com/Happyr/auth0-bundle/releases)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE)[![Total Downloads](https://camo.githubusercontent.com/7111d36a1863d75dec06fe0b51aa67bbcfaac7eb25e0905488d926e49e85f4ed/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6861707079722f61757468302d62756e646c652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/happyr/auth0-bundle)

Integrate the new authentication system from Symfony 5.2 with Auth0.

### Installation

[](#installation)

Install with Composer:

```
composer require happyr/auth0-bundle
```

Enable the bundle in bundles.php

```
return [
    // ...
    Happyr\Auth0Bundle\HappyrAuth0Bundle::class => ['all' => true],
];
```

Add your credentials and basic settings.

```
// config/packages/happyr_auth0.yaml
happyr_auth0:
    # In the sdk node, you can provide every settings provided by the auth0/auth0-PHP library
    # (https://github.com/auth0/auth0-PHP#configuration-options).
    # Only the "configuration" argument is not authorized.
    # For every parameter that reference an object, you must provide a service name.
    sdk:
        domain: '%env(AUTH0_DOMAIN)%'
        clientId: '%env(AUTH0_CLIENT_ID)%'
        clientSecret: '%env(AUTH0_SECRET)%'
        tokenCache: 'cache.app' # will reference the @cache.app service automatically
        managementTokenCache: 'cache.app'
        cookieSecret: '%kernel.secret%' # To encrypt cookie values
        scope:
          - openid # "openid" is required.
          - profile
          - email
```

You are now up and running and can use services `Auth0\SDK\Auth0`, `Auth0\SDK\API\Authentication`, `Auth0\SDK\API\Management` and `Auth0\SDK\Configuration\SdkConfiguration`.

If you want to integrate with the authentication system there are a bit more configuration you may do.

Authentication
--------------

[](#authentication)

Start by telling Symfony what entrypoint we use and add `auth0.authenticator` as "custom authenticator". This will make Symfony aware of the Auth0Bundle and how to use it.

```
// config/packages/security.yml
security:
    enable_authenticator_manager: true # Use the new authentication system

    # Example user provider
    providers:
        users:
            entity:
                class: 'App\Entity\User'
                property: 'auth0Id'

    firewalls:
        default:
            pattern:  ^/.*

            # Specify the entrypoint
            entry_point: auth0.entry_point

            # Add custom authenticator
            custom_authenticators:
                - auth0.authenticator

            # Example logout path
            logout:
                path: default_logout
                target: _user_logout
                invalidate_session: true
```

Next we need to configure the behavior of the bundle.

```
// config/packages/happyr_auth0.yaml
happyr_auth0:
    # ...

    firewall:
        # If a request comes into route default_login_check, we will intercept
        # it and redirect the user to auth0.
        check_route: default_login_check

        # The path or route where to redirect users on failure
        failure_path: default_logout

        # The default path or route to redirect users after login
        default_target_path: user_dashboard
```

The `failure_path` and `default_target_path` will use `Symfony\Component\Security\Http\Authentication\DefaultAuthenticationFailureHandler`and `Symfony\Component\Security\Http\Authentication\DefaultAuthenticationSuccessHandler`to handle redirects.

You may use your own handlers by specifying the service ids:

```
// config/packages/happyr_auth0.yaml
happyr_auth0:
   # ...

   firewall:
       # If a request comes into route default_login_check, we will intercept
       # it and redirect the user to auth0.
       check_route: default_login_check

       failure_handler: App\Security\AuthenticationHandler\MyFailureHandler
       success_handler: App\Security\AuthenticationHandler\MySuccessHandler
```

### Custom user provider

[](#custom-user-provider)

If you want to use a custom UserProvider that fetches a user with more data than just the Auth0 id, then you may create a service that implement `Happyr\Auth0Bundle\Security\Auth0UserProviderInterface`.

Then configure the bundle to use that service:

```
// config/packages/happyr_auth0.yaml
happyr_auth0:
    # ...

    firewall:
        # ..
        user_provider: App\UserProvider\Auth0UserProvider
```

Troubleshooting
---------------

[](#troubleshooting)

Make sure you have csrf\_protection enabled.

```
framework:
    csrf_protection:
        enabled: true
```

Example configuration
---------------------

[](#example-configuration)

Below is an example configuration. We use the `Psr6Store` to store all data in Redis and the session key in cookies. We also define to use the `MemoryStore` when testing.

```
happyr_auth0:
    sdk:
        domain: '%env(AUTH0_DOMAIN)%'
        clientId: '%env(AUTH0_CLIENT_ID)%'
        clientSecret: '%env(AUTH0_SECRET)%'
        # Use custom domain for universal login
        customDomain: '%env(AUTH0_LOGIN_DOMAIN)%'
        cookieSecret: '%kernel.secret%'
        tokenCache: 'cache.redis'
        managementTokenCache: 'cache.redis'
        transientStorage: 'auth0.storage.transient'
        sessionStorage: 'auth0.storage.session'
        scope:
            - openid # "openid" is required.
            - profile
            - email
    firewall:
        check_route: default_login_check
        failure_path: default_logout
        default_target_path: startpage

services:
    # Create a new SdkConfiguration service to be able to create
    # auth0.storage.cookie_* services without circular references

    auth0.sdk_cookie_config:
        class: Auth0\SDK\Configuration\SdkConfiguration
        arguments:
            - domain: '%env(AUTH0_DOMAIN)%'
              clientId: '%env(AUTH0_CLIENT_ID)%'
              clientSecret: '%env(AUTH0_SECRET)%'
              customDomain: '%env(AUTH0_LOGIN_DOMAIN)%'
              cookieSecret: '%kernel.secret%'

    auth0.storage.cookie_transient:
        class: Auth0\SDK\Store\CookieStore
        factory: ['@auth0.sdk_cookie_config', 'getTransientStorage']

    auth0.storage.cookie_session:
        class: Auth0\SDK\Store\CookieStore
        factory: ['@auth0.sdk_cookie_config', 'getSessionStorage']

    auth0.storage.transient:
        class: Auth0\SDK\Store\Psr6Store
        arguments: ['@auth0.storage.cookie_transient', '@cache.redis']

    auth0.storage.session:
        class: Auth0\SDK\Store\Psr6Store
        arguments: ['@auth0.storage.cookie_session', '@cache.redis']

when@test:
    services:
        test.auth0.session_storage:
            class: Auth0\SDK\Store\MemoryStore

        test.auth0.transient_storage:
            class: Auth0\SDK\Store\MemoryStore

    happyr_auth0:
        sdk:
            transientStorage: test.auth0.transient_storage
            sessionStorage: test.auth0.session_storage
```

###  Health Score

34

—

LowBetter than 77% of packages

Maintenance15

Infrequent updates — may be unmaintained

Popularity31

Limited adoption so far

Community17

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor1

Top contributor holds 85% 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 ~92 days

Recently: every ~147 days

Total

18

Last Release

1688d ago

PHP version history (5 changes)0.1.0PHP ^5.6 || ^7.0

0.4.0PHP ^7.1

0.6.0PHP ^7.2

0.7.0PHP &gt;=7.2.5

0.8.0PHP &gt;=7.4

### Community

Maintainers

![](https://www.gravatar.com/avatar/401ccc5eea13c60cf807ae982af00e368e2166e2f26d8eb541dcd881a57385bc?d=identicon)[Nyholm](/maintainers/Nyholm)

---

Top Contributors

[![Nyholm](https://avatars.githubusercontent.com/u/1275206?v=4)](https://github.com/Nyholm "Nyholm (85 commits)")[![magnusnordlander](https://avatars.githubusercontent.com/u/165002?v=4)](https://github.com/magnusnordlander "magnusnordlander (6 commits)")[![amenophis](https://avatars.githubusercontent.com/u/2158235?v=4)](https://github.com/amenophis "amenophis (4 commits)")[![morticue](https://avatars.githubusercontent.com/u/165028?v=4)](https://github.com/morticue "morticue (2 commits)")[![nicholasruunu](https://avatars.githubusercontent.com/u/483658?v=4)](https://github.com/nicholasruunu "nicholasruunu (1 commits)")[![clemherreman](https://avatars.githubusercontent.com/u/272812?v=4)](https://github.com/clemherreman "clemherreman (1 commits)")[![pgrimaud](https://avatars.githubusercontent.com/u/1866496?v=4)](https://github.com/pgrimaud "pgrimaud (1 commits)")

### Embed Badge

![Health badge](/badges/happyr-auth0-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/happyr-auth0-bundle/health.svg)](https://phpackages.com/packages/happyr-auth0-bundle)
```

###  Alternatives

[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.4k5.6M647](/packages/sylius-sylius)[sulu/sulu

Core framework that implements the functionality of the Sulu content management system

1.3k1.3M152](/packages/sulu-sulu)[shopware/platform

The Shopware e-commerce core

3.3k1.5M3](/packages/shopware-platform)[web-auth/webauthn-framework

FIDO2/Webauthn library for PHP and Symfony Bundle.

50570.7k1](/packages/web-auth-webauthn-framework)[simplesamlphp/simplesamlphp

A PHP implementation of a SAML 2.0 service provider and identity provider.

1.1k12.4M192](/packages/simplesamlphp-simplesamlphp)[contao/core-bundle

Contao Open Source CMS

1231.6M2.3k](/packages/contao-core-bundle)

PHPackages © 2026

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