From dc17aa29ad09a0075681f4574bd49d4bea993d97 Mon Sep 17 00:00:00 2001 From: James Fellows Date: Thu, 3 Nov 2016 12:05:13 +0000 Subject: [PATCH] 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 --- auth-server-auth-code.md | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/auth-server-auth-code.md b/auth-server-auth-code.md index b32aa00e..52948b70 100755 --- a/auth-server-auth-code.md +++ b/auth-server-auth-code.md @@ -95,11 +95,8 @@ _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) { +$app->get('/authorize', function (ServerRequestInterface $request, ResponseInterface $response) use ($server) { - /* @var \League\OAuth2\Server\AuthorizationServer $server */ - $server = $app->getContainer()->get(AuthorizationServer::class); - try { // Validate the HTTP request and return an AuthorizationRequest object. @@ -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 {