Skip to content

Implementing the storage interfaces

Alex Bilbie edited this page May 8, 2013 · 3 revisions

In order to use both the resource server and authorization server you need need to implement a number of interfaces.

If you are using the resource server you need to implement the session interface.

If you are using the authorization server you need to implement the session interface, scope interface and client interface.

Once you have written your classes then inject them into the server like so:

// authorization server
$server = new League\OAuth2\Server\Authorization(
    new OAuthClient,
    new OAuthSession,
    new OAuthScope
);

// resource server
$server = new League\OAuth2\Server\Resource(
    new OAuthSession
);

If you are using MySQL as your database then you can use the example queries given in the docblock for each function. If you are using another RDBMS please submit a pull request with SQL examples for your RDBMS.

If you aren't using MySQL please look at the example responses in the docblock for each function for guidance on how each method should respond.