PHPackages                             micropole-idea/oauth2-server-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. micropole-idea/oauth2-server-bundle

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

micropole-idea/oauth2-server-bundle
===================================

Symfony 4 OAuth2ServerBundle

v1.0.0(4y ago)0480MITPHPPHP &gt;=7.4

Since Mar 31Pushed 4y agoCompare

[ Source](https://github.com/Micropole-IDEA/oauth2-server-bundle)[ Packagist](https://packagist.org/packages/micropole-idea/oauth2-server-bundle)[ Docs](http://github.com/micropole-idea/oauth2-server-bundle)[ RSS](/packages/micropole-idea-oauth2-server-bundle/feed)WikiDiscussions master Synced today

READMEChangelog (1)Dependencies (10)Versions (6)Used By (0)

OAuth2 Server Bundle
====================

[](#oauth2-server-bundle)

Fork of OAuth2 Server Bundle for Symfony 3, built on the [oauth2-server-php](https://github.com/bshaffer/oauth2-server-php) library.

[![Build Status](https://camo.githubusercontent.com/fd9ee65cf237a2d802bfa52fcbb85a53cc21a5d35ff66e190f439db86c813ae5/68747470733a2f2f7365637572652e7472617669732d63692e6f72672f4d6963726f706f6c652d494445412f6f61757468322d7365727665722d62756e646c652e706e67)](http://travis-ci.org/Micropole-IDEA/oauth2-server-bundle)

Getting Started
---------------

[](#getting-started)

See the [Complete Documentation](http://bshaffer.github.io/oauth2-server-php-docs/) for information regarding the OAuth2.0 protocol and the PHP library used by this bundle to implement it.

For documentation specific to this bundle, continue reading below.

Bundle Overview
---------------

[](#bundle-overview)

The following grant types are supported out the box:

- Client Credentials
- Authorization Code
- Refresh Token
- User Credentials (see below)

You can make token requests to the `/token` path via POST.

You can restrict the grant types available per client in the database, use a Compiler Pass or in your own TokenController you could do something like:

```
public function tokenAction()
{
    $server = $this->get('oauth2.server');

    // Override default grant types to authorization code only
    $server->addGrantType($this->get('oauth2.grant_type.authorization_code'));

    return $server->handleTokenRequest($this->get('oauth2.request'), $this->get('oauth2.response'));
}
```

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

[](#installation)

### Step 1: Add package to Composer

[](#step-1-add-package-to-composer)

Use composer to add the requirement and download it by running the command:

```
$ composer require micropole_idea/oauth2-server-bundle
```

Composer will update your composer.json and install the bundle to your project's `vendor/bshaffer` directory.

### Step 2: Enable the bundle

[](#step-2-enable-the-bundle)

Enable the bundle in the kernel:

```
