Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
O

oauth2-server

> 安全
Open source

A spec compliant, secure by default PHP OAuth 2.0 Server

6.7K stars0 likes4 views
WebsiteGitHub

About

A spec compliant, secure by default PHP OAuth 2.0 Server

PHP OAuth 2.0 Server

league/oauth2-server is a standards compliant implementation of an OAuth 2.0 authorization server written in PHP which makes working with OAuth 2.0 trivial. You can easily configure an OAuth 2.0 server to protect your API with access tokens, or allow clients to request new access tokens and refresh them.

Out of the box it supports the following grants:

  • Authorization code grant
  • Client credentials grant
  • Device authorization grant
  • Implicit grant
  • Refresh grant
  • Resource owner password credentials grant

The following RFCs are implemented:

  • RFC6749 "OAuth 2.0"
  • RFC6750 "The OAuth 2.0 Authorization Framework: Bearer Token Usage"
  • RFC7519 "JSON Web Token (JWT)"
  • RFC7636 "Proof Key for Code Exchange by OAuth Public Clients"
  • RFC8628 "OAuth 2.0 Device Authorization Grant

This library was created by Alex Bilbie. Find him on Twitter at @alexbilbie.

Requirements

The latest version of this package supports the following versions of PHP:

  • PHP 8.2
  • PHP 8.3
  • PHP 8.4
  • PHP 8.5

The openssl and json extensions are also required.

All HTTP messages passed to the server should be PSR-7 compliant. This ensures interoperability with other packages and frameworks.

Installation

composer require league/oauth2-server

Documentation

The library documentation can be found at https://oauth2.thephpleague.com. You can contribute to the documentation in the gh-pages branch.

Testing

The library uses PHPUnit for unit tests.

vendor/bin/phpunit

Continuous Integration

We use Github Actions, Scrutinizer, and StyleCI for continuous integration. Check out our configuration files if you'd like to know more.

Community Integrations

  • Drupal
  • Laravel Passport
  • OAuth 2 Server for CakePHP 3
  • OAuth 2 Server for Mezzio
  • OAuth 2 Server Bundle (Symfony)
  • Heimdall for CodeIgniter 4

Changelog

See the project changelog

Contributing

Contributions are always welcome. Please see CONTRIBUTING.md and CODE_OF_CONDUCT.md for details.

Support

Bugs and feature request are tracked on GitHub.

If you have any questions about OAuth please open a ticket here; please don't email the address below.

Security

If you discover any security related issues, please email [email protected] instead of using the issue tracker.

License

This package is released under the MIT License. See the bundled LICENSE file for details.

Credits

This code is principally developed and maintained by Andy Millington.

Between 2012 and 2017 this library was developed and maintained by Alex Bilbie.

PHP OAuth 2.0 Server is one of many packages provided by The PHP League. To find out more, please visit our website.

Special thanks to all of these awesome contributors.

Additional thanks go to the Mozilla Secure Open Source Fund for funding a security audit of this library.

The initial code was developed as part of the Linkey project which was funded by JISC under the Access and Identity Management programme.

Issues· 76 open

View all issuesOpen on GitHub
  • #857

    BearerTokenValidator:validateAuthorization seems to incorrectly use the audience claim.

    Future VersionSpec ComplianceUpdated Aug 7, 2026
  • #1504

    Add RFC 8707 Resource Indicators for OAuth 2.0

    Updated Aug 5, 2026
  • #1513

    Provide grant type in ACCESS_TOKEN_ISSUED domain events

    Updated Aug 2, 2026
  • #1506

    Support RFC 9700-style refresh token rotation grace period with single-successor semantics

    Updated Apr 22, 2026
  • #1501

    Assert that array-key exists on decoded refresh token.

    Updated Mar 15, 2026
  • #1496

    Inconsistent Content-Type -header with lowercase t

    Updated Feb 6, 2026
  • #1434

    Not supporting [RFC 9068] Must add issuer claim to the access token JWT!

    Future VersionSpec ComplianceUpdated Dec 31, 2025
  • #649

    Making refresh tokens optional

    Improvement IdeaUpdated Dec 22, 2025
  • #806

    Token Revocation question

    Improvement IdeaUpdated Oct 22, 2025
  • #1315

    Add support for RFC8693 - token exchange

    Future VersionImprovement IdeaUpdated Oct 14, 2025

> Tags

PHPoauthoauth2oauth2-serverphp

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 23, 2026
Category安全
PricingOpen source

> Related tools

O
OWASP ZAP
开源 Web 应用安全扫描器
O
owasp-wstg-tracker
Simple web app to track OWASP WSTG security testing progress
H
homebridge-mi-gateway-security
XiaoMi Gateway Security plugin for HomeBridge.