PHPackages                             media24si/simple-oauth2 - 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. media24si/simple-oauth2

AbandonedArchivedLibrary[Authentication &amp; Authorization](/categories/authentication)

media24si/simple-oauth2
=======================

Laravel 5 Simple OAuth2

31.4k3PHP

Since Feb 15Pushed 4y ago2 watchersCompare

[ Source](https://github.com/Media24si/SimpleOAuth2)[ Packagist](https://packagist.org/packages/media24si/simple-oauth2)[ RSS](/packages/media24si-simple-oauth2/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (1)Used By (0)

THIS PROJECT IS DEPRECATED. Use [Laravel Passport](https://laravel.com/docs/master/passport) instead
====================================================================================================

[](#this-project-is-deprecated-use-laravel-passport-instead)

Laravel5 Simple OAuth2 Server Package
=====================================

[](#laravel5-simple-oauth2-server-package)

[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE)

A very simple OAuth2 package to use in your Laravel5 app. The package is a wrapper around the [oauth2-php](https://github.com/FriendsOfSymfony/oauth2-php) library and is inspired by [FOSOAuthServerBundle](https://github.com/FriendsOfSymfony/FOSOAuthServerBundle).

Current features:

- [Client credentials](https://tools.ietf.org/html/rfc6749#section-1.3.4) grant type
- [Resource Owner Password Credentials](https://tools.ietf.org/html/rfc6749#section-1.3.3) grant type
- [Refresh token](https://tools.ietf.org/html/rfc6749#section-1.5)
- [Grant extensions](https://tools.ietf.org/html/rfc6749#section-4.5)
- Middleware for checking valid token &amp; user

TODO:

- Scopes
- [Authorization Code](https://tools.ietf.org/html/rfc6749#section-1.3.1) grant type
- [Implicit](https://tools.ietf.org/html/rfc6749#section-1.3.2) grant type
- Test
- Integration with [Travis CI](https://travis-ci.org/)

Install
-------

[](#install)

Require this package with composer (Packagist) using the following command:

```
$ composer require media24si/simple-oauth2
```

Register the SimpleOAuth2ServiceProvider to the providers array in config/app.php

```
Media24si\SimpleOAuth2\SimpleOAuth2ServiceProvider::class,
```

Publish vendor files:

```
$ php artisan vendor:publish
```

Migrate your database

```
$ php artisan migrate
```

Create a route for generating tokens:

```
$ Route::any('/token', '\Media24si\SimpleOAuth2\Http\Controllers\TokenController@token');
```

If you want to use Authorization code or Implicit grant type add authore controller to rote:

```
Route::any('/authorize', ['middleware' => 'auth','uses' => '\Media24si\SimpleOAuth2\Http\Controllers\AuthorizeController@authorize']);
```

USAGE
-----

[](#usage)

### Config

[](#config)

When you publish vendor files, the **simpleoauth2.php** config file will be copied to the *config* folder. Currently the only configuration options are:

- a username field
- a password field
- additional conditions

SimpleOAuth2 uses **Auth::attempt** to authenticate users.

### Middleware

[](#middleware)

The package comes with one middleware. To use it, you need to register `app\Http\Kernel.php` under `$routeMiddleware`

```
'oauth' => '\Media24si\SimpleOAuth2\Http\Middleware\SimpleOAuth2'
```

Then in your routes you can request a valid oauth2 token:

```
Route::get('/protected', ['middleware' => ['oauth'], function() { return 'Protected resource'; }]);
```

Because SimpleOAuth2 is using Laravel authentication package you can request an authenticated user with oauth:

```
Route::get('/protected', ['middleware' => ['oauth', 'auth'], function() { return 'Protected resource with valid user'; }]);
```

### Artisan commands

[](#artisan-commands)

**oauth2:create-client**

```
$ php artisan oauth2:create-client {client_name}
```

Create a new oauth2 client. For all options see help

```
$ php artisan help oauth2:create-client {client_name}
```

**oauth2:list-clients**

```
$ php artisan oauth2:list-clients
```

List all oauth2 clients.

Grant types
-----------

[](#grant-types)

### Authorization Code and Implicit

[](#authorization-code-and-implicit)

To use authorization code or implicit grant types you have to provide auth middleware so user can login. You can customize authorize by implementing your own action and view.

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

21

—

LowBetter than 18% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity20

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity27

Early-stage or recently created project

 Bus Factor1

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

### Community

Maintainers

![](https://www.gravatar.com/avatar/17848fce32bf9d0ecfb9427ab0e842794bdd8b2c26eec791e5dad8d33b8703b5?d=identicon)[BostjanOb](/maintainers/BostjanOb)

---

Top Contributors

[![BostjanOb](https://avatars.githubusercontent.com/u/650818?v=4)](https://github.com/BostjanOb "BostjanOb (26 commits)")[![Neoglyph](https://avatars.githubusercontent.com/u/5198992?v=4)](https://github.com/Neoglyph "Neoglyph (2 commits)")

### Embed Badge

![Health badge](/badges/media24si-simple-oauth2/health.svg)

```
[![Health](https://phpackages.com/badges/media24si-simple-oauth2/health.svg)](https://phpackages.com/packages/media24si-simple-oauth2)
```

###  Alternatives

[kartik-v/yii2-password

Useful password strength validation utilities for Yii Framework 2.0

761.3M17](/packages/kartik-v-yii2-password)[vitalybaev/laravel5-dkim

Laravel 5/6 package for signing outgoing messages with DKIM.

3163.1k](/packages/vitalybaev-laravel5-dkim)

PHPackages © 2026

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