PHPackages                             sumocoders/oauth-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. sumocoders/oauth-bundle

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

sumocoders/oauth-bundle
=======================

v1.2.1(3mo ago)0784↓50%PHPPHP ^8.2

Since Apr 4Pushed 3mo ago1 watchersCompare

[ Source](https://github.com/sumocoders/OAuthBundle)[ Packagist](https://packagist.org/packages/sumocoders/oauth-bundle)[ RSS](/packages/sumocoders-oauth-bundle/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (7)Dependencies (7)Versions (11)Used By (0)

Create an application in Azure
------------------------------

[](#create-an-application-in-azure)

- Go to [Azure Portal](https://portal.azure.com/)
- Search for "App registrations"
- Click "New registration"
    - Name: The name of the application, eg: the url of the webapplication
    - Supported account types: select "Accounts in this organizational directory only (... only - single tenant)"
    - Redirect URI, you will need to add extra urls later on.
        - platform: web, url:
    - You will be redirect to the newly created app registration
    - Note down the Application (client) ID and Dorectory (tenant) ID
- Click "Redirect URIs" → Click "Add URI" and add the urls provided. And save. Eg:
    -
    -
- Click "Certificates &amp; Secrets" → Click "New client secret"
    - Description: the url of the webapplication
    - Expires: 12 months, or as long as you feel comfortable with
    - Click "Save"
    - Note down the Value and Secret ID
- Provide the following to your integrator:
    - Application (client) ID
    - Directory (tenant) ID
    - Client secret Value
    - Client secret ID

Full article: [Register a Microsoft Entra app and create a service principal](https://learn.microsoft.com/en-us/entra/identity-platform/howto-create-service-principal-portal)

Allow the application to be used
--------------------------------

[](#allow-the-application-to-be-used)

When this is done, you still need to allow the users to use this application:

- Go to [Azure Portal](https://portal.azure.com)
- Search for "App registrations"
- Select the newly created application
- Select "Manage → API Permissions" on the left
- Click "Granty admin consent for ..."

Full article: [Grant tenant-wide admin consent to an application](https://learn.microsoft.com/en-us/azure/active-directory/manage-apps/grant-admin-consent?pivots=portal)

Configure the roles
-------------------

[](#configure-the-roles)

- Go to the [Azure Portal](https://portal.azure.com)
- Search for "App registrations"
- Select your application
- Click "Manage → App roles" on the left.
- Create a role for each role in your application
    - display\_name: provided value (can be changed to something more readable)
    - allowed member types: both
    - value: provided value
    - enable this app role: yes

Full article: [Add app roles to your application and receive them in the token](https://learn.microsoft.com/en-us/azure/active-directory/develop/howto-add-app-roles-in-azure-ad-apps)

Give users a role
-----------------

[](#give-users-a-role)

- Go to the [Azure Portal](https://portal.azure.com)
- Search for "Microsoft Entra ID"
- Click "Manage → Enterprise applications" on the left
- Select your created application
- Select "Manage → Users and groups" on the left.
- Add user/groups with the correct role

Full article: [Assign users and groups to roles](https://learn.microsoft.com/en-us/azure/active-directory/develop/howto-add-app-roles-in-azure-ad-apps#assign-users-and-groups-to-roles)

Configure the application
-------------------------

[](#configure-the-application)

This example shows two applications, the default 'azure' and 'sumocoders'.

Add the needed bundles to your bundles.php file

```
return [
    ...,
    KnpU\OAuth2ClientBundle\KnpUOAuth2ClientBundle::class => ['all' => true],
    SumoCoders\OAuthBundle\SumoCodersOAuthBundle::class => ['all' => true],
];
```

Update your security.yml file to mirror the following config

```
security:
    providers:
        app_user_provider:
            entity:
            class: SumoCoders\OAuthBundle\Entity\User
            property: externalId
    firewalls:
        dev:
            pattern: ^/(_(profiler|wdt)|css|images|js)/
            security: false
        main:
            lazy: true
            provider: app_user_provider
            entry_point: SumoCoders\OAuthBundle\Security\AzureAuthenticator
            custom_authenticators:
                - SumoCoders\OAuthBundle\Security\AzureAuthenticator
                - azure_authenticator_sumocoders
            logout:
                path: logout
                target: home #Your home page
```

Define the extra custom authenticators in services.yaml

The client parameter should be the same as defined in knpu\_oauth2\_client (see below)

Optionally use a different user class that implements SumoCoders\\OAuthBundle\\Entity\\UserInterface, also update the user provider in that case.

```
services:
    azure_authenticator_sumocoders:
        class: SumoCoders\OAuthBundle\Security\AzureAuthenticator
        arguments:
            $client: 'sumocoders'
            $userClass: App\Entity\User\User
```

Add the following ENV variables to your .env file

```
AZURE_CLIENT_ID= #Your client id
AZURE_CLIENT_SECRET= #Your client secret
AZURE_TENANT= #Your tenant id

SUMOCODERS_CLIENT_ID=
SUMOCODERS_CLIENT_SECRET=
SUMOCODERS_TENANT=
```

Configure the routes
--------------------

[](#configure-the-routes)

Add the following routes to your routes.yaml file

Make sure the prefix of the extra routes is the same as the client name.

```
oauth_bundle:
    resource: '@SumoCodersOAuthBundle/config/routes.yaml'
    prefix: /

oauth_bundle_sumocoders:
    resource: '@SumoCodersOAuthBundle/config/routes.yaml'
    prefix: /sumocoders
    name_prefix: sumocoders_
```

Configure the OAuth bundle
--------------------------

[](#configure-the-oauth-bundle)

Add the following clients to your knpu\_oauth2\_client.yaml file

```
knpu_oauth2_client:
    clients:
        azure:
            type: azure
            client_id: '%env(AZURE_CLIENT_ID)%'
            client_secret: '%env(AZURE_CLIENT_SECRET)%'
            redirect_route: connect_azure_check
            default_end_point_version: 2.0
            tenant: '%env(AZURE_TENANT)%'

        sumocoders:
            type: azure
            client_id: '%env(SUMOCODERS_CLIENT_ID)%'
            client_secret: '%env(SUMOCODERS_CLIENT_SECRET)%'
            redirect_route: sumocoders_connect_azure_check
            default_end_point_version: 2.0
            tenant: '%env(SUMOCODERS_TENANT)%'
```

###  Health Score

45

—

FairBetter than 93% of packages

Maintenance79

Regular maintenance activity

Popularity17

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor1

Top contributor holds 80% 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 ~171 days

Recently: every ~163 days

Total

7

Last Release

112d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/24cc7447ed4afda1df3b35bbb79728c0de07227466f1a647284fde597c888b8d?d=identicon)[bjorvack](/maintainers/bjorvack)

---

Top Contributors

[![absumo](https://avatars.githubusercontent.com/u/116194801?v=4)](https://github.com/absumo "absumo (12 commits)")[![tijsverkoyen](https://avatars.githubusercontent.com/u/250042?v=4)](https://github.com/tijsverkoyen "tijsverkoyen (3 commits)")

### Embed Badge

![Health badge](/badges/sumocoders-oauth-bundle/health.svg)

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

###  Alternatives

[sylius/sylius

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

8.4k5.6M651](/packages/sylius-sylius)[easycorp/easyadmin-bundle

Admin generator for Symfony applications

4.3k16.7M310](/packages/easycorp-easyadmin-bundle)[sulu/sulu

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

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

PrestaShop is an Open Source e-commerce platform, committed to providing the best shopping cart experience for both merchants and customers.

9.0k15.4k](/packages/prestashop-prestashop)[contao/core-bundle

Contao Open Source CMS

1231.6M2.4k](/packages/contao-core-bundle)[ec-cube/ec-cube

EC-CUBE EC open platform.

78527.0k1](/packages/ec-cube-ec-cube)

PHPackages © 2026

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