Update Slim example in auth-code docs

As it stands, if a user isn't familiar with Slim and they put both
the Setup code and the Implementation example into a file, a request
fails with:

The implementation code implies the user has put the setup code into a Slim
container - which they won't know they need to do.

Instead, this doc update simply provides direct access to the  that is configured
in the Setup block - so everything can work as-is
This commit is contained in:
James Fellows 2016-11-03 12:05:13 +00:00
parent 6f0dc0c839
commit dc17aa29ad

View File

@ -95,10 +95,7 @@ _Please note: These examples here demonstrate usage with the Slim Framework; Sli
The client will redirect the user to an authorization endpoint.
{% highlight php %}
$app->get('/authorize', function (ServerRequestInterface $request, ResponseInterface $response) use ($app) {
/* @var \League\OAuth2\Server\AuthorizationServer $server */
$server = $app->getContainer()->get(AuthorizationServer::class);
$app->get('/authorize', function (ServerRequestInterface $request, ResponseInterface $response) use ($server) {
try {
@ -140,10 +137,7 @@ $app->get('/authorize', function (ServerRequestInterface $request, ResponseInter
The client will request an access token using an authorization code so create an `/access_token` endpoint.
{% highlight php %}
$app->post('/access_token', function (ServerRequestInterface $request, ResponseInterface $response) use ($app) {
/* @var \League\OAuth2\Server\AuthorizationServer $server */
$server = $app->getContainer()->get(AuthorizationServer::class);
$app->post('/access_token', function (ServerRequestInterface $request, ResponseInterface $response) use ($server) {
try {