PHPackages                             silasjoisten/sonata-oauth2-login-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. silasjoisten/sonata-oauth2-login-bundle

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

silasjoisten/sonata-oauth2-login-bundle
=======================================

Login via Google with Email Validation in a Sonata Project

6.1.0(2y ago)283.5k—7.1%5[2 PRs](https://github.com/silasjoisten/sonata-oauth2-login-bundle/pulls)MITPHPPHP ^8.0

Since May 12Pushed 2y ago2 watchersCompare

[ Source](https://github.com/silasjoisten/sonata-oauth2-login-bundle)[ Packagist](https://packagist.org/packages/silasjoisten/sonata-oauth2-login-bundle)[ RSS](/packages/silasjoisten-sonata-oauth2-login-bundle/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (12)Versions (23)Used By (0)

silasjoisten/sonata-oauth2-login-bundle
=======================================

[](#silasjoistensonata-oauth2-login-bundle)

[![Build Status](https://camo.githubusercontent.com/a3d33e4ec275c9c81c5276777b7f5a08dcaa67d1229d29235cdb21ecee9eea21/68747470733a2f2f7472617669732d63692e6f72672f73696c61736a6f697374656e2f736f6e6174612d6f61757468322d6c6f67696e2d62756e646c652e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/silasjoisten/sonata-oauth2-login-bundle)[![Latest Stable Version](https://camo.githubusercontent.com/c2eac7cd421a3f28e3504efeed19f1e11808887e686a4c407ca34ea68d3d31a6/68747470733a2f2f706f7365722e707567782e6f72672f73696c61736a6f697374656e2f736f6e6174612d6f61757468322d6c6f67696e2d62756e646c652f762f737461626c65)](https://packagist.org/packages/silasjoisten/sonata-oauth2-login-bundle)[![Total Downloads](https://camo.githubusercontent.com/bd076082a677bdd64f3ece333dd65e4d46198132024c655c4b764fa7a28432f7/68747470733a2f2f706f7365722e707567782e6f72672f73696c61736a6f697374656e2f736f6e6174612d6f61757468322d6c6f67696e2d62756e646c652f646f776e6c6f616473)](https://packagist.org/packages/silasjoisten/sonata-oauth2-login-bundle)[![Latest Unstable Version](https://camo.githubusercontent.com/776feaa6c3b1a5c1ef2f71bdaee3981b617cddf914c41197769ac9a0b824dc4a/68747470733a2f2f706f7365722e707567782e6f72672f73696c61736a6f697374656e2f736f6e6174612d6f61757468322d6c6f67696e2d62756e646c652f762f756e737461626c65)](https://packagist.org/packages/silasjoisten/sonata-oauth2-login-bundle)[![License](https://camo.githubusercontent.com/a800f86597b8e178273fbbeb60956277d4b45a9cd713a7a4df5a5d6445bd941b/68747470733a2f2f706f7365722e707567782e6f72672f73696c61736a6f697374656e2f736f6e6174612d6f61757468322d6c6f67696e2d62756e646c652f6c6963656e7365)](https://packagist.org/packages/silasjoisten/sonata-oauth2-login-bundle)

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

[](#installation)

```
composer require silasjoisten/sonata-oauth2-login-bundle
```

Register the Bundle in **app/AppKernel.php**:

```
 class AppKernel extends Kernel
 {
     public function registerBundles()
     {
        // ..
        new Http\HttplugBundle\HttplugBundle(),
        new HWI\Bundle\OAuthBundle\HWIOAuthBundle(),
        new SilasJoisten\Sonata\Oauth2LoginBundle\SonataOauth2LoginBundle(),
        // ..
     }

    // ..
}
```

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

[](#configuration)

### Include the Routing:

[](#include-the-routing)

```
SonataOauth2LoginBundle:
    resource: "@SonataOauth2LoginBundle/Resources/config/routing.xml"
```

### Configure the Bundle:

[](#configure-the-bundle)

```
sonata_oauth2_login:
    valid_email_domains: ["@your-domain.com"]
    default_user_roles: ["ROLE_SONATA_ADMIN"]
    #optional value
    custom_emails:
        test@example.com: ["ROLE_SUPER_ADMIN"]
        test2@example.de: ["ROLE_SONATA_ADMIN"]
```

*You can add as much valid domains as you want*

### Configure the HWIOauthBundle:

[](#configure-the-hwioauthbundle)

```
# app/config/security.yml

security:
   providers:
      hwi:
         id: sonata_oauth2_login.user.provider

         #...

   firewalls:
      YOUR_FIREWALL:
         #pattern: /admin(.*) REMOVE THIS LINE IF YOU ARE USING SONATA ADMIN
         oauth:
            resource_owners:
               google:         "/login/check-google"
            login_path:        /admin/login                 # For Sonata Admin
            use_forward:       false
            default_target_path: /admin/dashboard           # For Sonata Admin
            failure_path:      /admin/login                 # For Sonata Admin
            oauth_user_provider:
               service:  sonata_oauth2_login.user.provider
```

```
# app/config/config.yml

hwi_oauth:
    firewall_names: [YOUR_FIREWALL]
    resource_owners:
        google:
            type:                "google"
            client_id:           "YOUR_CLIENT_ID"
            client_secret:       "YOUR_CLIENT_SECRET"
            scope:               "email profile"
            options:
                csrf: true
                access_type:     offline
```

Usage
-----

[](#usage)

To use the OAuth2 login you just need to call the Twig function to render the button in your login template like this:

```
{{ render_login_button() }}
```

Optional: You can pass an *array* inside to to set custom *class* and *value*

Look and Feel
-------------

[](#look-and-feel)

[![Look and Feel](docs/screenshot.png)](docs/screenshot.png)

###  Health Score

41

—

FairBetter than 89% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity34

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity78

Established project with proven stability

 Bus Factor1

Top contributor holds 85.4% 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 ~117 days

Recently: every ~255 days

Total

20

Last Release

1068d ago

Major Versions

1.1.2 → 2.1.12017-12-15

2.1.1 → 3.0.02018-03-28

3.0.0 → 4.0.02018-04-26

4.0.0 → 5.0.02019-07-29

5.1.0 → 6.0.02021-11-10

PHP version history (5 changes)1.0.4PHP &gt;=5.5.9

2.0.0PHP &gt;=5.6

4.0.0PHP ^7.0

5.0.0PHP ^7.2

6.0.0PHP ^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/437bc57a840f5da84f34d6500ec6326b1ce7bf8412d236415f09bd5afa0dc58e?d=identicon)[silasjoisten](/maintainers/silasjoisten)

---

Top Contributors

[![OskarStark](https://avatars.githubusercontent.com/u/995707?v=4)](https://github.com/OskarStark "OskarStark (35 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (3 commits)")[![kurt-junker](https://avatars.githubusercontent.com/u/133669142?v=4)](https://github.com/kurt-junker "kurt-junker (2 commits)")[![silasjoisten](https://avatars.githubusercontent.com/u/10114981?v=4)](https://github.com/silasjoisten "silasjoisten (1 commits)")

###  Code Quality

TestsPHPUnit

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/silasjoisten-sonata-oauth2-login-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/silasjoisten-sonata-oauth2-login-bundle/health.svg)](https://phpackages.com/packages/silasjoisten-sonata-oauth2-login-bundle)
```

###  Alternatives

[simplesamlphp/simplesamlphp

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

1.1k12.4M193](/packages/simplesamlphp-simplesamlphp)[happyr/linkedin-api-client

LinkedIn API client. Handles OAuth, CSRF protection. Easy to implement and extend. This is a standalone library for any composer project.

1991.6M12](/packages/happyr-linkedin-api-client)[nucleos/profile-bundle

Registration and profile management for symfony

12218.5k1](/packages/nucleos-profile-bundle)[privacyidea/simplesamlphp-module-privacyidea

Add multi-factor authentication to simpleSAMLphp. The second factors are managed in privacyIDEA.

232.4k](/packages/privacyidea-simplesamlphp-module-privacyidea)

PHPackages © 2026

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