photon / oauth2-server
OAuth 2 helper for photon
Installs: 147
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 0
pkg:composer/photon/oauth2-server
Requires
- bshaffer/oauth2-server-php: ~1.8
- photon/photon: >=0.3.0
This package is auto-updated.
Last update: 2025-10-10 20:56:59 UTC
README
Quick start
-
Add the module in your project
composer require "photon/oauth2-server:dev-master"
or for a specific version
composer require "photon/oauth2-server:1.0.0"
- Create a OAuth2 server class
You need to extends the abstract class "Server". This class perform automatics convertion for $request and $response object.
class MyOAuth2Server extends \photon\auth\oauth2\Server
{
protected function initializeServer(&$server)
{
$storage = new \OAuth2\Storage\Mongo();
$server->addStorage($storage);
$server->addGrantType(new \OAuth2\GrantType\AuthorizationCode($storage));
...
}
}
You can use this class like the original "\OAuth2\Server".
-
Define your oauth server class in the project configuration
'oauth_server' => '\foo\bar\MyOAuth2Server'
-
Enjoy !