mirror of
https://github.com/elyby/oauth2-server.git
synced 2024-12-02 11:40:47 +05:30
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:
parent
6f0dc0c839
commit
dc17aa29ad
@ -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.
|
The client will redirect the user to an authorization endpoint.
|
||||||
|
|
||||||
{% highlight php %}
|
{% 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 {
|
try {
|
||||||
|
|
||||||
// Validate the HTTP request and return an AuthorizationRequest object.
|
// 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.
|
The client will request an access token using an authorization code so create an `/access_token` endpoint.
|
||||||
|
|
||||||
{% highlight php %}
|
{% highlight php %}
|
||||||
$app->post('/access_token', function (ServerRequestInterface $request, ResponseInterface $response) use ($app) {
|
$app->post('/access_token', function (ServerRequestInterface $request, ResponseInterface $response) use ($server) {
|
||||||
|
|
||||||
/* @var \League\OAuth2\Server\AuthorizationServer $server */
|
|
||||||
$server = $app->getContainer()->get(AuthorizationServer::class);
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user