PHPackages                             friendsofhyperf/oauth2-server - 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. friendsofhyperf/oauth2-server

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

friendsofhyperf/oauth2-server
=============================

The Oauth2 server for hyperf.

v3.1.75(5mo ago)3155MITPHP

Since Jul 20Pushed 4mo agoCompare

[ Source](https://github.com/friendsofhyperf/oauth2-server)[ Packagist](https://packagist.org/packages/friendsofhyperf/oauth2-server)[ Fund](https://hdj.me/sponsors/)[ GitHub Sponsors](https://github.com/huangdijia)[ RSS](/packages/friendsofhyperf-oauth2-server/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (8)Dependencies (4)Versions (10)Used By (0)

FriendsOfHyperf OAuth2 Server
=============================

[](#friendsofhyperf-oauth2-server)

A complete OAuth2 server implementation for Hyperf framework, based on [league/oauth2-server](https://oauth2.thephpleague.com/).

Features
--------

[](#features)

- Full OAuth2 server implementation supporting:
    - Client Credentials Grant
    - Password Grant
    - Refresh Token Grant
    - Authorization Code Grant (with PKCE support)
- Built-in commands for:
    - Client management (create/delete/list)
    - Key pair generation
    - Token cleanup
- Multiple storage backends (Eloquent ORM)
- Customizable token lifetimes
- Scope management

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

[](#installation)

1. Install via Composer:

```
composer require friendsofhyperf/oauth2-server
```

2. Publish configuration:

```
php bin/hyperf.php vendor:publish friendsofhyperf/oauth2-server
```

3. Generate encryption keys:

```
# Generate private/public key pair
php bin/hyperf.php oauth2:generate-keypair
```

4. Run migrations (if using database storage):

```
php bin/hyperf.php migrate
```

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

[](#configuration)

Configure your OAuth2 server in `config/autoload/oauth2-server.php`:

```
