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

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

knplabs/knp-oauth-bundle
========================

An OAuth firewall for Symfony2

2.0.x-dev(11y ago)491359MITPHPPHP &gt;=5.3.2

Since Jan 13Pushed 11y ago8 watchersCompare

[ Source](https://github.com/KnpLabs/KnpOAuthBundle)[ Packagist](https://packagist.org/packages/knplabs/knp-oauth-bundle)[ Docs](http://github.com/KnpLabs/KnpOAuthBundle)[ RSS](/packages/knplabs-knp-oauth-bundle/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (2)Versions (3)Used By (0)

This project is no longer maintained by KnpLabs
===============================================

[](#this-project-is-no-longer-maintained-by-knplabs)

Use [HWIOAuthBundle](https://github.com/hwi/HWIOAuthBundle) instead
-------------------------------------------------------------------

[](#use-hwioauthbundle-instead)

KnpOAuthBundle, an OAuth firewall for Symfony2
==============================================

[](#knpoauthbundle-an-oauth-firewall-for-symfony2)

Instructions for 2.1 branch
---------------------------

[](#instructions-for-21-branch)

Please note this is the 2.1 compatible branch of this bundle. If you are using Symfony 2.0.\*, then you should upgrade. If you can't, you can still use the [2.0 branch](https://github.com/KnpLabs/KnpOAuthBundle/tree/2.0).

Introduction
------------

[](#introduction)

This bundle provides an OAuth firewall for Symfony2.

You should really read the [full documentation](https://github.com/KnpLabs/KnpOAuthBundle/blob/master/Resources/doc/01_index.md), but if you're in a hurry (I know you are), this file should help you quickly getting a working setup.

Requirements
------------

[](#requirements)

- Symfony (*2.1 (master branch) or later*)
- Dependencies:
- [`Buzz`](https://github.com/kriswallsmith/Buzz) (*0.5 or later*)
- [`SensioBuzzBundle`](https://github.com/sensio/SensioBuzzBundle)

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

[](#installation)

Add this to your `deps`:

```
[Buzz]
    git=https://github.com/kriswallsmith/Buzz.git
    version=v0.5

[BuzzBundle]
    git=https://github.com/sensio/SensioBuzzBundle.git
    target=/bundles/Sensio/Bundle/BuzzBundle

[KnpOAuthBundle]
    git=https://github.com/KnpLabs/KnpOAuthBundle.git
    target=/bundles/Knp/Bundle/OAuthBundle

```

Then run the usual `bin/vendors`:

```
bin/vendors install

```

Register autoloads:

```
$loader->registerNamespaces(array(
    'Knp'              => __DIR__.'/../vendor/bundles',
    'Buzz'             => __DIR__.'/../vendor/Buzz/lib'
));

```

Register the bundles in your `AppKernel`:

```
$bundles = array(
    new Knp\Bundle\OAuthBundle\KnpOAuthBundle(),
    new Sensio\Bundle\BuzzBundle\SensioBuzzBundle(),
);

```

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

[](#configuration)

Using the `KnpOAuthBundle` is just a matter of configuring an `oauth` firewall in your `security.yml`. The bundle exposes a number of configuration directives to suit your oauth needs. Here's a pretty standard security configuration:

```
security:
    firewalls:
        login:
            pattern:    ^/secured/login$
            security:   false
        secured_area:
            pattern:    ^/secured/
            oauth:
                oauth_provider:    oauth
                authorization_url: https://github.com/login/oauth/authorize
                access_token_url:  https://github.com/login/oauth/access_token
                infos_url:         https://github.com/api/v2/json/user/show
                username_path:     user.login
                client_id:
                secret:
                scope:
                check_path:        /secured/login_check
                login_path:        /secured/login

```

Please see [the configuration reference](https://github.com/KnpLabs/KnpOAuthBundle/blob/master/Resources/doc/03_configuration.md) for a description of the configuration options.

Right now, what you probably want to know is that this bundle comes with a few pre-configured oauth provider, namely:

- `github` (required options: `client_id`, `secret`)
- er... that's all for now.

If you don't see your favorite provider in the list, don't worry, there are three solutions, depending on how much of a hurry you're in:

1. [Implement it](https://github.com/KnpLabs/KnpOAuthBundle/blob/master/Resources/doc/05_custom_oauth_providers.md) (and it would be awesome if you contributed it afterwards)
2. [Use the generic OAuth provider](https://github.com/KnpLabs/KnpOAuthBundle/blob/master/Resources/doc/04_builtin_oauth_providers.md)
3. [Ask us to implement it](https://github.com/KnpLabs/KnpOAuthBundle/issues/new). (please provide as much information as possible (`authorize_url`, `access_token_url`, `infos_url` (with its response format) and `username_path` would be nice))

User providers
--------------

[](#user-providers)

Most of the time, if you are using Doctrine, you will want to use the `EntityUserProvider`.

This provider fetches users from the database and creates them on the fly if they don't already exist. It requires Doctrine to work. It works exactly like Doctrine's entity user provider, except its configuration key is `oauth_entity`:

```
providers:
    secured_area:
        oauth_entity:
            class: KnpBundlesBundle:User
            property: name

```

###  Health Score

29

—

LowBetter than 57% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity24

Limited adoption so far

Community20

Small or concentrated contributor base

Maturity45

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 86.5% 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

Unknown

Total

1

Last Release

4132d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/202732?v=4)[KNP Labs](/maintainers/KnpLabs)[@KnpLabs](https://github.com/KnpLabs)

---

Top Contributors

[![ubermuda](https://avatars.githubusercontent.com/u/10758?v=4)](https://github.com/ubermuda "ubermuda (77 commits)")[![stloyd](https://avatars.githubusercontent.com/u/67402?v=4)](https://github.com/stloyd "stloyd (7 commits)")[![marijn](https://avatars.githubusercontent.com/u/65233?v=4)](https://github.com/marijn "marijn (1 commits)")[![asm89](https://avatars.githubusercontent.com/u/657357?v=4)](https://github.com/asm89 "asm89 (1 commits)")[![rybakit](https://avatars.githubusercontent.com/u/533861?v=4)](https://github.com/rybakit "rybakit (1 commits)")[![mbontemps](https://avatars.githubusercontent.com/u/231249?v=4)](https://github.com/mbontemps "mbontemps (1 commits)")[![gimler](https://avatars.githubusercontent.com/u/200904?v=4)](https://github.com/gimler "gimler (1 commits)")

---

Tags

securityoauthfirewall

### Embed Badge

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

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

###  Alternatives

[hwi/oauth-bundle

Support for authenticating users using both OAuth1.0a and OAuth2 in Symfony.

2.4k22.3M81](/packages/hwi-oauth-bundle)[simplesamlphp/simplesamlphp

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

1.1k13.0M217](/packages/simplesamlphp-simplesamlphp)[scheb/2fa

Two-factor authentication for Symfony applications (please use scheb/2fa-bundle to install)

585684.2k1](/packages/scheb-2fa)[auth0/symfony

Symfony SDK for Auth0 Authentication and Management APIs.

128814.6k](/packages/auth0-symfony)[rcsofttech/audit-trail-bundle

Enterprise-grade, high-performance Symfony audit trail bundle. Automatically track Doctrine entity changes with split-phase architecture, multiple transports (HTTP, Queue, Doctrine), and sensitive data masking.

1189.8k](/packages/rcsofttech-audit-trail-bundle)[klapaudius/oauth-server-bundle

Symfony(5.x to 8.x) OAuth Server Bundle

16688.1k4](/packages/klapaudius-oauth-server-bundle)

PHPackages © 2026

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