Merge pull request #237 from leevigraham/gh-pages

Couple of syntax updates
This commit is contained in:
Alex Bilbie 2014-11-06 05:21:58 -05:00
commit 6d57c99a66
2 changed files with 6 additions and 4 deletions

View File

@ -22,6 +22,8 @@ $passwordGrant = new \League\OAuth2\Server\Grant\PasswordGrant();
$passwordGrant->setVerifyCredentialsCallback(function ($username, $password) { $passwordGrant->setVerifyCredentialsCallback(function ($username, $password) {
// implement logic here to validate a username and password, return an ID if valid, otherwise return false // implement logic here to validate a username and password, return an ID if valid, otherwise return false
}); });
$server->addGrantType($passwordGrant);
~~~ ~~~
@ -37,7 +39,7 @@ $router->post('/access_token', function (Request $request) use ($server) {
$response = $server->issueAccessToken(); $response = $server->issueAccessToken();
return new Response( return new Response(
json_encode($response), json_encode($response),
200 200,
[ [
'Content-type' => 'application/json', 'Content-type' => 'application/json',
'Cache-Control' => 'no-store', 'Cache-Control' => 'no-store',

View File

@ -90,7 +90,7 @@ This grant is suitable for trusted clients such as a services own mobile clie
~~~ php ~~~ php
$clientCredentials = new League\OAuth2\Server\Grant\ClientCredentialsGrant(); $clientCredentials = new League\OAuth2\Server\Grant\ClientCredentialsGrant();
server->addGrantType($clientCredentials); $server->addGrantType($clientCredentials);
~~~ ~~~
This grant is similar to the resource owner credentials grant except only the clients credentials are used to authenticate a request for an access token. Again this grant should only be allowed to be used by trusted clients. This grant is similar to the resource owner credentials grant except only the clients credentials are used to authenticate a request for an access token. Again this grant should only be allowed to be used by trusted clients.